aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-12-27 22:43:28 +0100
committerHarald Welte <laforge@gnumonks.org>2010-12-28 00:38:10 +0100
commita665a9e0b282af03453b45853789866856673553 (patch)
treed3bb423146540665deb9f8a641f3829d6b763478
parentdbe012a1ba3fdd304297c734c3f66fb67b6f2908 (diff)
subscr: Make the subscr_put_channel work with the subscr
The active channel might or might not be gone when the transaction has been released. Instead of passing an invalid subscriber conn we will pass the subscr that is ref-counted and guranteed to be valid at this point. subscr_put_channel could search the connections for an active connection if that is ever needed.
-rw-r--r--openbsc/include/openbsc/gsm_subscriber.h2
-rw-r--r--openbsc/src/gsm_04_11.c7
-rw-r--r--openbsc/src/gsm_subscriber.c6
3 files changed, 9 insertions, 6 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 29317e822..1318ae8fc 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -80,7 +80,7 @@ struct gsm_subscriber *subscr_get_by_id(struct gsm_network *net,
struct gsm_subscriber *subscr_get_or_create(struct gsm_network *net,
const char *imsi);
int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason);
-void subscr_put_channel(struct gsm_subscriber_connection *conn);
+void subscr_put_channel(struct gsm_subscriber *subscr);
void subscr_get_channel(struct gsm_subscriber *subscr,
int type, gsm_cbfn *cbfn, void *param);
struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_network *net,
diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c
index 25fe467d6..cf9356cb6 100644
--- a/openbsc/src/gsm_04_11.c
+++ b/openbsc/src/gsm_04_11.c
@@ -140,7 +140,7 @@ static void gsm411_release_conn(struct gsm_subscriber_connection *conn)
if (!conn)
return;
- subscr_put_channel(conn);
+ subscr_put_channel(conn->subscr);
}
struct msgb *gsm411_msgb_alloc(void)
@@ -1187,8 +1187,10 @@ void _gsm411_sms_trans_free(struct gsm_trans *trans)
void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn)
{
+ struct gsm_subscriber *subscr;
struct gsm_trans *trans, *tmp;
+ subscr = subscr_get(conn->subscr);
llist_for_each_entry_safe(trans, tmp, &conn->bts->network->trans_list, entry)
if (trans->conn == conn) {
struct gsm_sms *sms = trans->sms.sms;
@@ -1203,6 +1205,7 @@ void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn)
trans_free(trans);
}
- gsm411_release_conn(conn);
+ subscr_put_channel(subscr);
+ subscr_put(subscr);
}
diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c
index dc7d638f1..44f58e25e 100644
--- a/openbsc/src/gsm_subscriber.c
+++ b/openbsc/src/gsm_subscriber.c
@@ -209,7 +209,7 @@ void subscr_get_channel(struct gsm_subscriber *subscr,
}
}
-void subscr_put_channel(struct gsm_subscriber_connection *conn)
+void subscr_put_channel(struct gsm_subscriber *subscr)
{
/*
* FIXME: Continue with other requests now... by checking
@@ -229,8 +229,8 @@ void subscr_put_channel(struct gsm_subscriber_connection *conn)
* will listen to the paging requests before we timeout
*/
- if (conn->subscr && !llist_empty(&conn->subscr->requests))
- subscr_send_paging_request(conn->subscr);
+ if (subscr && !llist_empty(&subscr->requests))
+ subscr_send_paging_request(subscr);
}