diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-22 07:58:24 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-22 08:02:13 +0100 |
commit | 5c18ad08293ae6f95edd75e6bcc370fd6cff069b (patch) | |
tree | 120273d6da84a0bdb52b32f981714e9bcaea0f59 /openbsc/src/chan_alloc.c | |
parent | 0d9ed87d5c7d5b6e21dc3bbb282e215068742566 (diff) | |
parent | 4f5456c040c2dd0c53fe28cb51219d668d464a21 (diff) |
Merge commit 'origin/master' into on-waves/bsc-master
Conflicts:
openbsc/include/openbsc/Makefile.am
openbsc/include/openbsc/gsm_data.h
openbsc/src/Makefile.am
openbsc/src/abis_rsl.c
openbsc/src/chan_alloc.c
openbsc/src/gsm_04_08.c
openbsc/src/gsm_data.c
openbsc/src/vty_interface.c
The biggest problem is the moving of the RTP code into
the RSL layer. This may break quite some things...
Diffstat (limited to 'openbsc/src/chan_alloc.c')
-rw-r--r-- | openbsc/src/chan_alloc.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c index b4f080585..27d582931 100644 --- a/openbsc/src/chan_alloc.c +++ b/openbsc/src/chan_alloc.c @@ -201,9 +201,14 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type) break; case GSM_LCHAN_TCH_H: lchan =_lc_find_bts(bts, GSM_PCHAN_TCH_H); + /* If we don't have TCH/H available, fall-back to TCH/F */ + if (!lchan) { + lchan = _lc_find_bts(bts, GSM_PCHAN_TCH_F); + type = GSM_LCHAN_TCH_F; + } break; default: - fprintf(stderr, "Unknown gsm_chan_t %u\n", type); + LOGP(DRLL, LOGL_ERROR, "Unknown gsm_chan_t %u\n", type); } if (lchan) { @@ -227,6 +232,8 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type) /* Free a logical channel */ void lchan_free(struct gsm_lchan *lchan) { + int i; + lchan->type = GSM_LCHAN_NONE; if (lchan->subscr) { subscr_put(lchan->subscr); @@ -239,6 +246,16 @@ void lchan_free(struct gsm_lchan *lchan) lchan->use_count = 0; } + bsc_del_timer(&lchan->T3101); + + /* clear cached measuement reports */ + lchan->meas_rep_idx = 0; + for (i = 0; i < ARRAY_SIZE(lchan->meas_rep); i++) { + lchan->meas_rep[i].flags = 0; + lchan->meas_rep[i].nr = 0; + } + for (i = 0; i < ARRAY_SIZE(lchan->neigh_meas); i++) + lchan->neigh_meas[i].arfcn = 0; /* FIXME: ts_free() the timeslot, if we're the last logical * channel using it */ } @@ -259,11 +276,11 @@ int _lchan_release(struct gsm_lchan *lchan) } /* spoofed? message */ - if (lchan->use_count < 0) { - DEBUGP(DRLL, "BUG: channel count is negative: %d\n", lchan->use_count); - } + if (lchan->use_count < 0) + LOGP(DRLL, LOGL_ERROR, "Channel count is negative: %d\n", + lchan->use_count); - DEBUGP(DRLL, "Releasing the channel with: %d (%x)\n", lchan->nr, lchan->nr); + DEBUGP(DRLL, "Recycling the channel with: %d (%x)\n", lchan->nr, lchan->nr); rsl_release_request(lchan, 0); return 1; } |