aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--include/bsc_data.h1
-rw-r--r--src/main.c8
-rw-r--r--src/msc_conn.c13
3 files changed, 14 insertions, 8 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 1427db5..f24af5d 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -109,7 +109,6 @@ void bsc_link_up(struct link_data *data);
/* msc related functions */
int msc_init(struct bsc_data *bsc);
-void msc_schedule_reconnect(struct bsc_data *bsc);
void msc_send_rlc(struct bsc_data *bsc, struct sccp_source_reference *src, struct sccp_source_reference *dest);
void msc_send_reset(struct bsc_data *bsc);
void msc_send_msg(struct bsc_data *bsc, int rc, struct sccp_parse_result *, struct msgb *msg);
diff --git a/src/main.c b/src/main.c
index bb15ed9..5d63ff4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -272,7 +272,6 @@ static void clear_connections(struct bsc_data *bsc)
void bsc_resources_released(struct bsc_data *bsc)
{
bsc_del_timer(&bsc->reset_timeout);
- msc_schedule_reconnect(bsc);
}
static void bsc_reset_timeout(void *_data)
@@ -376,11 +375,8 @@ void bsc_link_down(struct link_data *data)
/* clear pending messages from the MSC */
msc_clear_queue(data->bsc);
- /* for the case the link is going down while we are trying to reset */
- if (data->bsc->msc_link_down)
- msc_schedule_reconnect(data->bsc);
- else if (was_up)
- msc_send_reset(data->bsc);
+ /* If we have an A link send a reset to the MSC */
+ msc_send_reset(data->bsc);
}
void bsc_link_up(struct link_data *data)
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) {