aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_rll.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-10 17:36:46 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-10 17:59:31 +0800
commit2e234f524c4f799fc45036af38fe2c08582fba46 (patch)
tree737cc1496dce7c2b79bf83a15d63d9856cd8ac24 /openbsc/src/bsc_rll.c
parent4fe22cc56df597cd18bedb2c2e0957e3ffc428b9 (diff)
bsc_rll: Stop using lchan refcounts, use the lchan signal to stop the timer
Stop using the lchan refcounts and start handling the lchan release to stop timers and free the RLL resources for the channel.
Diffstat (limited to 'openbsc/src/bsc_rll.c')
-rw-r--r--openbsc/src/bsc_rll.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/openbsc/src/bsc_rll.c b/openbsc/src/bsc_rll.c
index 9a4f5aae4..a8e642fa7 100644
--- a/openbsc/src/bsc_rll.c
+++ b/openbsc/src/bsc_rll.c
@@ -31,6 +31,7 @@
#include <openbsc/gsm_data.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/abis_rsl.h>
+#include <openbsc/signal.h>
struct bsc_rll_req {
struct llist_head list;
@@ -55,7 +56,6 @@ static void complete_rllr(struct bsc_rll_req *rllr, enum bsc_rllr_ind type)
conn = &rllr->lchan->conn;
llist_del(&rllr->list);
- put_subscr_con(conn);
rllr->cb(rllr->lchan, rllr->link_id, rllr->data, type);
talloc_free(rllr);
}
@@ -88,7 +88,6 @@ int rll_establish(struct gsm_lchan *lchan, u_int8_t sapi,
link_id |= 0x40;
conn = &lchan->conn;
- use_subscr_con(conn);
rllr->lchan = lchan;
rllr->link_id = link_id;
rllr->cb = cb;
@@ -120,3 +119,29 @@ void rll_indication(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t type)
}
}
}
+
+static int rll_lchan_signal(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ struct challoc_signal_data *challoc;
+ struct bsc_rll_req *rllr, *rllr2;
+
+ if (subsys != SS_CHALLOC || signal != S_CHALLOC_FREED)
+ return 0;
+
+ challoc = (struct challoc_signal_data *) signal_data;
+
+ llist_for_each_entry_safe(rllr, rllr2, &bsc_rll_reqs, list) {
+ if (rllr->lchan == challoc->lchan) {
+ bsc_del_timer(&rllr->timer);
+ complete_rllr(rllr, BSC_RLLR_IND_ERR_IND);
+ }
+ }
+
+ return 0;
+}
+
+static __attribute__((constructor)) void on_dso_load_rll(void)
+{
+ register_signal_handler(SS_CHALLOC, rll_lchan_signal, NULL);
+}