aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-07 04:42:03 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-07 06:07:42 +0800
commitd4eed5208fa9181517ce5e89f0db8c4636cbf288 (patch)
treef63c21d6c30d19be7f09367eca8e50f60505f47d /openbsc/src
parent85531cc60d592d93f6ca09d65c7b1913851bc23a (diff)
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...
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/bsc_msc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c
index e89269b6c..a5734de51 100644
--- a/openbsc/src/bsc_msc.c
+++ b/openbsc/src/bsc_msc.c
@@ -77,6 +77,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) {
@@ -94,7 +97,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);
@@ -213,6 +215,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);
}