From 588c423f12a67b924c0a89d4cc0fc003ff2d077e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 7 Oct 2010 04:42:03 +0800 Subject: msc: Stop the connection timeout when we unregister the bfd When we dropped the connection... stop the timer as we might call bsc_unregister_fd twice... --- openbsc/src/bsc_msc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c index 48eab8c35..a78a1416d 100644 --- a/openbsc/src/bsc_msc.c +++ b/openbsc/src/bsc_msc.c @@ -76,6 +76,9 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what) queue = container_of(fd, struct write_queue, bfd); con = container_of(queue, struct bsc_msc_connection, write_queue); + /* From here on we will either be connected or reconnect */ + bsc_del_timer(&con->timeout_timer); + /* check the socket state */ rc = getsockopt(fd->fd, SOL_SOCKET, SO_ERROR, &val, &len); if (rc != 0) { @@ -93,7 +96,6 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what) fd->when = BSC_FD_READ | BSC_FD_EXCEPT; con->is_connected = 1; - bsc_del_timer(&con->timeout_timer); LOGP(DMSC, LOGL_NOTICE, "(Re)Connected to the MSC.\n"); if (con->connected) con->connected(con); @@ -214,6 +216,7 @@ struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio) void bsc_msc_lost(struct bsc_msc_connection *con) { write_queue_clear(&con->write_queue); + bsc_del_timer(&con->timeout_timer); bsc_unregister_fd(&con->write_queue.bfd); connection_loss(con); } -- cgit v1.2.3