aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/ussd.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-06-19 18:06:02 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:29 +0100
commite005619dc6cbfcbd260cab6b2535d10eb0e75c6d (patch)
tree07075bb26ade2ef8e866ed2b2b818014b363cd81 /openbsc/src/libmsc/ussd.c
parent7564acac242e6112b70b493b314a74baaca1f6e8 (diff)
Introduce subscriber_connection ref-counting
This introduces a reference count for gsm_subscriber_connection. Every user of the connection needs to hold a reference until done. Once the reference count dorps to zero, the connection is cleared towards the BSC (which subsequently will clear any logical channels associated with it). Related: OS#1592 Change-Id: I8c05e6c81f246ff8b5bf91312f80410b1a85f15e
Diffstat (limited to 'openbsc/src/libmsc/ussd.c')
-rw-r--r--openbsc/src/libmsc/ussd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/openbsc/src/libmsc/ussd.c b/openbsc/src/libmsc/ussd.c
index f12c1f281..a27b16376 100644
--- a/openbsc/src/libmsc/ussd.c
+++ b/openbsc/src/libmsc/ussd.c
@@ -48,13 +48,17 @@ int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
struct ss_request req;
struct gsm48_hdr *gh;
+ /* TODO: Use subscriber_connection ref-counting if we ever want
+ * to keep the connection alive due ot ongoing USSD exchange.
+ * As we answer everytying synchronously so far, there's no need
+ * yet */
+
memset(&req, 0, sizeof(req));
gh = msgb_l3(msg);
rc = gsm0480_decode_ss_request(gh, msgb_l3len(msg), &req);
if (!rc) {
DEBUGP(DMM, "Unhandled SS\n");
rc = gsm0480_send_ussd_reject(conn, msg, &req);
- msc_release_connection(conn);
return rc;
}
@@ -63,7 +67,6 @@ int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
if (req.ss_code > 0) {
/* Assume interrogateSS or modification of it and reject */
rc = gsm0480_send_ussd_reject(conn, msg, &req);
- msc_release_connection(conn);
return rc;
}
/* Still assuming a Release-Complete and returning */
@@ -78,8 +81,6 @@ int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
rc = gsm0480_send_ussd_reject(conn, msg, &req);
}
- /* check if we can release it */
- msc_release_connection(conn);
return rc;
}