aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-11-22 14:33:12 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2017-11-27 15:40:01 +0100
commit6166f29412ef1dc3395dcee914ec98bd013663b4 (patch)
treeccbb38f1d76ae3126dd4ef967a4103b827f18f13 /include
parent2f108b09a953ee1285a8ebff948a3ad7bfa77780 (diff)
subscr_conn: introduce usage tokens for ref error tracking
When hunting a conn use count bug, it was very hard to figure out who's (not) using the conn. To ease tracking down this bug and future bugs, explicitly name what a conn is being reserved for, and track in a bit mask. Show in the DREF logs what uses and un-uses a conn. See the test expectation updates, which nicely show how that clarifies the state of the conn in the logs. On errors, log them, but don't fail hard: if one conn use/un-use fails, we don't want to crash the entire MSC before we have to. Change-Id: I259aa0eec41efebb4c8221275219433eafaa549b
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/msc/gsm_data.h1
-rw-r--r--include/osmocom/msc/osmo_msc.h25
2 files changed, 22 insertions, 4 deletions
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index e0fbcec9f..696cef1c3 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -139,6 +139,7 @@ struct gsm_subscriber_connection {
/* usage count. If this drops to zero, we start the release
* towards A/Iu */
uint32_t use_count;
+ uint32_t use_tokens;
/* The MS has opened the conn with a CM Service Request, and we shall
* keep it open for an actual request (or until timeout). */
diff --git a/include/osmocom/msc/osmo_msc.h b/include/osmocom/msc/osmo_msc.h
index 5f4713ee8..bf455c309 100644
--- a/include/osmocom/msc/osmo_msc.h
+++ b/include/osmocom/msc/osmo_msc.h
@@ -84,14 +84,31 @@ void msc_subscr_conn_communicating(struct gsm_subscriber_connection *conn);
void msc_subscr_conn_close(struct gsm_subscriber_connection *conn,
uint32_t cause);
-#define msc_subscr_conn_get(conn) \
- _msc_subscr_conn_get(conn, __BASE_FILE__, __LINE__)
-#define msc_subscr_conn_put(conn) \
- _msc_subscr_conn_put(conn, __BASE_FILE__, __LINE__)
+enum msc_subscr_conn_use {
+ MSC_CONN_USE_UNTRACKED = -1,
+ MSC_CONN_USE_COMPL_L3,
+ MSC_CONN_USE_DTAP,
+ MSC_CONN_USE_FSM,
+ MSC_CONN_USE_TRANS_CC,
+ MSC_CONN_USE_TRANS_SMS,
+ MSC_CONN_USE_TRANS_USSD,
+ MSC_CONN_USE_SILENT_CALL,
+};
+
+extern const struct value_string msc_subscr_conn_use_names[];
+static inline const char *msc_subscr_conn_use_name(enum msc_subscr_conn_use val)
+{ return get_value_string(msc_subscr_conn_use_names, val); }
+
+#define msc_subscr_conn_get(conn, balance_token) \
+ _msc_subscr_conn_get(conn, balance_token, __BASE_FILE__, __LINE__)
+#define msc_subscr_conn_put(conn, balance_token) \
+ _msc_subscr_conn_put(conn, balance_token, __BASE_FILE__, __LINE__)
struct gsm_subscriber_connection *
_msc_subscr_conn_get(struct gsm_subscriber_connection *conn,
+ enum msc_subscr_conn_use balance_token,
const char *file, int line);
void _msc_subscr_conn_put(struct gsm_subscriber_connection *conn,
+ enum msc_subscr_conn_use balance_token,
const char *file, int line);
void msc_stop_paging(struct vlr_subscr *vsub);