diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-22 14:33:12 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-27 15:40:01 +0100 |
commit | 6166f29412ef1dc3395dcee914ec98bd013663b4 (patch) | |
tree | ccbb38f1d76ae3126dd4ef967a4103b827f18f13 /src/libmsc/transaction.c | |
parent | 2f108b09a953ee1285a8ebff948a3ad7bfa77780 (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 'src/libmsc/transaction.c')
-rw-r--r-- | src/libmsc/transaction.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c index 01d69c24e..4dcd24db1 100644 --- a/src/libmsc/transaction.c +++ b/src/libmsc/transaction.c @@ -117,12 +117,16 @@ struct gsm_trans *trans_alloc(struct gsm_network *net, */ void trans_free(struct gsm_trans *trans) { + enum msc_subscr_conn_use conn_usage_token = MSC_CONN_USE_UNTRACKED; + switch (trans->protocol) { case GSM48_PDISC_CC: _gsm48_cc_trans_free(trans); + conn_usage_token = MSC_CONN_USE_TRANS_CC; break; case GSM48_PDISC_SMS: _gsm411_sms_trans_free(trans); + conn_usage_token = MSC_CONN_USE_TRANS_SMS; break; } @@ -139,7 +143,7 @@ void trans_free(struct gsm_trans *trans) llist_del(&trans->entry); if (trans->conn) - msc_subscr_conn_put(trans->conn); + msc_subscr_conn_put(trans->conn, conn_usage_token); trans->conn = NULL; talloc_free(trans); |