aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/chan_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/chan_alloc.c')
-rw-r--r--openbsc/src/chan_alloc.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index 7ba679c87..b4f080585 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -33,8 +33,6 @@
#include <openbsc/debug.h>
#include <openbsc/signal.h>
-static void auto_release_channel(void *_lchan);
-
struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts,
enum gsm_phys_chan_config pchan)
{
@@ -218,10 +216,9 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type)
/* clear multi rate config */
memset(&lchan->mr_conf, 0, sizeof(lchan->mr_conf));
- /* Configure the time and start it so it will be closed */
- lchan->release_timer.cb = auto_release_channel;
- lchan->release_timer.data = lchan;
- bsc_schedule_timer(&lchan->release_timer, LCHAN_RELEASE_TIMEOUT);
+ /* clear any msc reference */
+ lchan->msc_data = NULL;
+
}
return lchan;
@@ -242,44 +239,35 @@ void lchan_free(struct gsm_lchan *lchan)
lchan->use_count = 0;
}
- /* stop the timer */
- bsc_del_timer(&lchan->release_timer);
-
/* FIXME: ts_free() the timeslot, if we're the last logical
* channel using it */
}
/* Consider releasing the channel now */
-int lchan_auto_release(struct gsm_lchan *lchan)
+int _lchan_release(struct gsm_lchan *lchan)
{
if (lchan->use_count > 0) {
+ DEBUGP(DRLL, "BUG: _lchan_release called without zero use_count.\n");
return 0;
}
/* Assume we have GSM04.08 running and send a release */
if (lchan->subscr) {
+ ++lchan->use_count;
gsm48_send_rr_release(lchan);
+ --lchan->use_count;
}
/* spoofed? message */
if (lchan->use_count < 0) {
- DEBUGP(DRLL, "Channel count is negative: %d\n", lchan->use_count);
+ DEBUGP(DRLL, "BUG: channel count is negative: %d\n", lchan->use_count);
}
- DEBUGP(DRLL, "Recycling the channel with: %d (%x)\n", lchan->nr, lchan->nr);
+ DEBUGP(DRLL, "Releasing the channel with: %d (%x)\n", lchan->nr, lchan->nr);
rsl_release_request(lchan, 0);
return 1;
}
-/* Auto release the channel when the use count is zero */
-static void auto_release_channel(void *_lchan)
-{
- struct gsm_lchan *lchan = _lchan;
-
- if (!lchan_auto_release(lchan))
- bsc_schedule_timer(&lchan->release_timer, LCHAN_RELEASE_TIMEOUT);
-}
-
struct gsm_lchan* lchan_find(struct gsm_bts *bts, struct gsm_subscriber *subscr) {
struct gsm_bts_trx *trx;
int ts_no, lchan_no;