libmsc/gsm_09_11.c: introduce counter for active sessions

Change-Id: Ia17e7c747fffb5267d3ca5bc4193c1be4a57ef3a
This commit is contained in:
Vadim Yanitskiy 2018-06-26 18:27:25 +07:00 committed by Harald Welte
parent 2b2829fa70
commit 6afef893e1
3 changed files with 11 additions and 0 deletions

View File

@ -276,6 +276,7 @@ struct gsm_network {
struct rate_ctr_group *msc_ctrs;
struct osmo_counter *active_calls;
struct osmo_counter *active_nc_ss;
/* layer 4 */
struct mncc_sock_state *mncc_state;

View File

@ -107,6 +107,9 @@ int gsm0911_rcv_nc_ss(struct gsm_subscriber_connection *conn, struct msgb *msg)
return -ENOMEM;
}
/* Count active NC SS/USSD sessions */
osmo_counter_inc(conn->network->active_nc_ss);
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_NC_SS);
trans->dlci = OMSC_LINKID_CB(msg);
cm_service_request_concludes(conn, msg);
@ -300,6 +303,9 @@ static struct gsm_trans *establish_nc_ss_trans(struct gsm_network *net,
return NULL;
}
/* Count active NC SS/USSD sessions */
osmo_counter_inc(net->active_nc_ss);
/* Assign transaction ID */
tid = trans_assign_trans_id(trans->net,
trans->vsub, GSM48_PDISC_NC_SS, 0);
@ -365,6 +371,9 @@ void _gsm911_nc_ss_trans_free(struct gsm_trans *trans)
*/
if (trans->ss.msg != NULL)
msgb_free(trans->ss.msg);
/* One session less */
osmo_counter_dec(trans->net->active_nc_ss);
}
int gsm0911_gsup_handler(struct vlr_subscr *vsub,

View File

@ -67,6 +67,7 @@ struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv)
return NULL;
}
net->active_calls = osmo_counter_alloc("msc.active_calls");
net->active_nc_ss = osmo_counter_alloc("msc.active_nc_ss");
net->mncc_recv = mncc_recv;