aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/transaction.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-22 03:25:11 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-24 06:16:04 +0100
commit22481bf76d129d3c41d20b96b6587ef085be485b (patch)
tree8c8de852e945dd5422a83bc7e0c37548d2911fe2 /openbsc/src/transaction.c
parentb973955295b720b8ba7c556d0165750ed9bfb381 (diff)
parent61b4232c6363ff9d78ef73b9dbf47ec16c94d610 (diff)
Merge remote branch 'origin/master' into on-waves/bsc-master
* Move to libosmocore * Move to new debugging architecture * Register the BTS types * Has only been compile tested Conflicts: openbsc/include/openbsc/Makefile.am openbsc/include/openbsc/gsm_data.h openbsc/include/openbsc/ipaccess.h openbsc/include/openbsc/mgcp.h openbsc/include/openbsc/msgb.h openbsc/include/openbsc/tlv.h openbsc/src/Makefile.am openbsc/src/abis_rsl.c openbsc/src/bsc_init.c openbsc/src/bsc_mgcp.c openbsc/src/chan_alloc.c openbsc/src/debug.c openbsc/src/gsm_subscriber_base.c openbsc/src/msgb.c openbsc/src/rest_octets.c openbsc/src/sccp/sccp.c openbsc/src/vty/command.c openbsc/src/vty_interface.c openbsc/tests/Makefile.am
Diffstat (limited to 'openbsc/src/transaction.c')
-rw-r--r--openbsc/src/transaction.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/openbsc/src/transaction.c b/openbsc/src/transaction.c
index 2f5681433..23dfe073d 100644
--- a/openbsc/src/transaction.c
+++ b/openbsc/src/transaction.c
@@ -23,7 +23,7 @@
#include <openbsc/gsm_data.h>
#include <openbsc/mncc.h>
#include <openbsc/debug.h>
-#include <openbsc/talloc.h>
+#include <osmocore/talloc.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/mncc.h>
@@ -120,7 +120,7 @@ int trans_assign_trans_id(struct gsm_subscriber *subscr,
struct gsm_network *net = subscr->net;
struct gsm_trans *trans;
unsigned int used_tid_bitmask = 0;
- int i;
+ int i, j, h;
if (ti_flag)
ti_flag = 0x8;
@@ -134,9 +134,14 @@ int trans_assign_trans_id(struct gsm_subscriber *subscr,
used_tid_bitmask |= (1 << trans->transaction_id);
}
+ /* find a new one, trying to go in a 'circular' pattern */
+ for (h = 6; h > 0; h--)
+ if (used_tid_bitmask & (1 << (h | ti_flag)))
+ break;
for (i = 0; i < 7; i++) {
- if ((used_tid_bitmask & (1 << (i | ti_flag))) == 0)
- return i | ti_flag;
+ j = ((h + i) % 7) | ti_flag;
+ if ((used_tid_bitmask & (1 << j)) == 0)
+ return j;
}
return -1;