From 4e42b637fde1dd76b5c65ffc47b86e69d7356e46 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 27 Jan 2010 07:52:30 +0100 Subject: [bsc_msc] Start the Inactivity Timer only when the connection is established Start the SCCP IT timer only after the MSC has confirmed the SCCP connection. It is safe to call bsc_del_timer even if it was never started. This could happen on a connection refusal. --- openbsc/src/bsc_msc_ip.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c index e7db79cd9..33bdf50c0 100644 --- a/openbsc/src/bsc_msc_ip.c +++ b/openbsc/src/bsc_msc_ip.c @@ -166,7 +166,16 @@ void msc_outgoing_sccp_state(struct sccp_connection *conn, int old_state) sccp_connection_free(conn); return; } else if (conn->connection_state == SCCP_CONNECTION_STATE_ESTABLISHED) { + struct bss_sccp_connection_data *con_data; + DEBUGP(DMSC, "Connection established: %p\n", conn); + + /* start the inactivity test timer */ + con_data = (struct bss_sccp_connection_data *) conn->data_ctx; + con_data->sccp_it.cb = sccp_it_fired; + con_data->sccp_it.data = con_data; + bsc_schedule_timer(&con_data->sccp_it, SCCP_IT_TIMER, 0); + bsc_send_queued(conn); } } @@ -216,11 +225,6 @@ int open_sccp_connection(struct msgb *layer3) sccp_connection->data_ctx = con_data; layer3->lchan->msc_data = con_data; - /* start the inactivity test timer */ - con_data->sccp_it.cb = sccp_it_fired; - con_data->sccp_it.data = con_data; - bsc_schedule_timer(&con_data->sccp_it, SCCP_IT_TIMER, 0); - /* FIXME: Use transaction for this */ use_lchan(layer3->lchan); sccp_connection_connect(sccp_connection, &sccp_ssn_bssap, data); -- cgit v1.2.3