aboutsummaryrefslogtreecommitdiffstats
path: root/src/msc_conn.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-07 05:41:06 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-07 05:41:06 +0800
commit7b7c297c8f5de70fb534643c28b2bd5851f08f90 (patch)
tree9a9941969ed39cc60444826306231ca6f080f439 /src/msc_conn.c
parente33d93c3666b941b39bf288f3888fccdbb28964c (diff)
msc: Separate the BSC and MSC link completly...
Make the msc_conn responsible for creating the link to the core network and reopening it, make the BTS code just call the msc methods and the MSC will throw away data in case it can not be forwarded. This avoids a problem that we start a reconnect timer while we have a connection in progress and then add the same file descriptor twice. This is mostly a speculative fix to the problem.
Diffstat (limited to 'src/msc_conn.c')
-rw-r--r--src/msc_conn.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/msc_conn.c b/src/msc_conn.c
index 19394f8..aabd151 100644
--- a/src/msc_conn.c
+++ b/src/msc_conn.c
@@ -44,6 +44,7 @@
static void msc_send_id_response(struct bsc_data *bsc);
static void msc_send(struct bsc_data *bsc, struct msgb *msg, int proto);
+static void msc_schedule_reconnect(struct bsc_data *bsc);
void mtp_link_slta_recv(struct mtp_link *link)
{
@@ -83,6 +84,7 @@ void msc_close_connection(struct bsc_data *bsc)
release_bsc_resources(bsc);
bsc_del_timer(&bsc->ping_timeout);
bsc_del_timer(&bsc->pong_timeout);
+ msc_schedule_reconnect(bsc);
}
static void msc_connect_timeout(void *_bsc_data)
@@ -377,7 +379,7 @@ static void msc_reconnect(void *_data)
bsc_schedule_timer(&bsc->msc_timeout, bsc->msc_time, 0);
}
-void msc_schedule_reconnect(struct bsc_data *bsc)
+static void msc_schedule_reconnect(struct bsc_data *bsc)
{
bsc_schedule_timer(&bsc->reconnect_timer, RECONNECT_TIME);
}
@@ -519,11 +521,20 @@ int msc_init(struct bsc_data *bsc)
/* create MGCP port */
if (mgcp_create_port(bsc) != 0)
return -1;
+
+ /* now connect to the BSC */
+ msc_schedule_reconnect(bsc);
return 0;
}
static void msc_send(struct bsc_data *bsc, struct msgb *msg, int proto)
{
+ if (bsc->msc_link_down) {
+ LOGP(DMSC, LOGL_NOTICE, "Dropping data due lack of MSC connection.\n");
+ msgb_free(msg);
+ return;
+ }
+
ipaccess_prepend_header(msg, proto);
if (write_queue_enqueue(&bsc->msc_connection, msg) != 0) {