aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_msc_ip.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-14 17:25:16 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-14 17:27:49 +0800
commit2300d69df6d59b2e615691fe341eab18018ac128 (patch)
treeaeb12b0f9f400deddc22b4ca740382cf9cd75fa8 /openbsc/src/bsc_msc_ip.c
parentc67cd2e11a15a974b633b1c083395fc7930417c7 (diff)
bsc: Increase the hand_off variable when we are done with the lchan.
Every time the highlevel code is done with the channel, increase the value. This way we will be able to see if we are leaking a channel that was never used or should have returned to the system.
Diffstat (limited to 'openbsc/src/bsc_msc_ip.c')
-rw-r--r--openbsc/src/bsc_msc_ip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index 558c0345e..032d057ef 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -136,12 +136,14 @@ static void bss_close_lchans(struct bss_sccp_connection_data *bss)
{
if (bss->lchan) {
bss->lchan->msc_data = NULL;
+ bss->lchan->conn.hand_off += 1;
put_subscr_con(&bss->lchan->conn, 0);
bss->lchan = NULL;
}
if (bss->secondary_lchan) {
bss->secondary_lchan->msc_data = NULL;
+ bss->secondary_lchan->conn.hand_off += 1;
put_subscr_con(&bss->secondary_lchan->conn, 0);
bss->secondary_lchan = NULL;
}
@@ -422,12 +424,14 @@ static int handle_ass_compl(struct msgb *msg)
if (!msg->lchan->msc_data) {
LOGP(DMSC, LOGL_ERROR, "No MSC data\n");
+ msg->lchan->conn.hand_off += 1;
put_subscr_con(&msg->lchan->conn, 0);
return -1;
}
if (msg->lchan->msc_data->secondary_lchan != msg->lchan) {
LOGP(DMSC, LOGL_ERROR, "Wrong assignment complete.\n");
+ msg->lchan->conn.hand_off += 1;
put_subscr_con(&msg->lchan->conn, 0);
return -1;
}
@@ -435,6 +439,7 @@ static int handle_ass_compl(struct msgb *msg)
if (msgb_l3len(msg) - sizeof(*gh) != 1) {
LOGP(DMSC, LOGL_ERROR, "assignment compl invalid: %d\n",
msgb_l3len(msg) - sizeof(*gh));
+ msg->lchan->conn.hand_off += 1;
put_subscr_con(&msg->lchan->conn, 0);
return -1;
}
@@ -453,6 +458,7 @@ static int handle_ass_compl(struct msgb *msg)
if (old_chan->conn.subscr)
subscr_put(old_chan->conn.subscr);
old_chan->conn.subscr = NULL;
+ old_chan->conn.hand_off += 1;
put_subscr_con(&old_chan->conn, 1);
}
@@ -476,6 +482,7 @@ static int handle_ass_fail(struct msgb *msg)
LOGP(DMSC, LOGL_ERROR, "ASSIGNMENT FAILURE from MS, forwarding to MSC\n");
if (!msg->lchan->msc_data) {
LOGP(DMSC, LOGL_ERROR, "No MSC data\n");
+ msg->lchan->conn.hand_off += 1;
put_subscr_con(&msg->lchan->conn, 0);
return -1;
}
@@ -484,6 +491,7 @@ static int handle_ass_fail(struct msgb *msg)
if (msg->lchan->msc_data->lchan != msg->lchan) {
LOGP(DMSC, LOGL_NOTICE, "Failure should come on the old link.\n");
msg->lchan->msc_data = NULL;
+ msg->lchan->conn.hand_off += 1;
put_subscr_con(&msg->lchan->conn, 0);
return -1;
}
@@ -612,6 +620,7 @@ int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id)
} else if (rc <= 0 && !msg->lchan->msc_data && msg->lchan->conn.use_count == 0) {
if (msg->lchan->state == LCHAN_S_ACTIVE) {
LOGP(DMSC, LOGL_NOTICE, "Closing unowned channel.\n");
+ msg->lchan->conn.hand_off += 1;
use_subscr_con(&msg->lchan->conn);
put_subscr_con(&msg->lchan->conn, 0);
}