From 79f763fe9151b06bea6fa2d1c94d71b86db4539e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 16 Sep 2010 00:53:37 +0800 Subject: bsc: Keep all active subscriber connections in a list. --- openbsc/include/openbsc/gsm_data.h | 2 ++ openbsc/src/bsc_api.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index e0f7c7049..016cdaacf 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -228,6 +228,8 @@ enum gsm_lchan_state { /* the per subscriber data for lchan */ struct gsm_subscriber_connection { + struct llist_head entry; + /* To whom we are allocated at the moment */ struct gsm_subscriber *subscr; diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c index 6c2a467e4..5048f2b96 100644 --- a/openbsc/src/bsc_api.c +++ b/openbsc/src/bsc_api.c @@ -33,6 +33,8 @@ #include +static LLIST_HEAD(sub_connections); + static void rll_ind_cb(struct gsm_lchan *, uint8_t, void *, enum bsc_rllr_ind); static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id); @@ -48,6 +50,7 @@ struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan) conn->lchan = lchan; conn->bts = lchan->ts->trx->bts; lchan->conn = conn; + llist_add_tail(&conn->entry, &sub_connections); return conn; } @@ -70,6 +73,8 @@ void subscr_con_free(struct gsm_subscriber_connection *conn) if (conn->ho_lchan) LOGP(DNM, LOGL_ERROR, "The ho_lchan should have been cleared.\n"); + llist_del(&conn->entry); + lchan = conn->lchan; talloc_free(conn); -- cgit v1.2.3