aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-12-18 22:52:52 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-18 22:58:28 +0000
commitea9968f6854cbfe79506efedc43a953a7c38cdd6 (patch)
tree3ee5825a149285bb9197315a10ec0922ce3823d0 /src
parentef784e4e9e09e9bdcc81b6223f26ef22e88cc3c7 (diff)
Fix tests after rate_ctr change
Recent change lin libosmocore disallow registering rate_ctr with the same name and indexing multiple times. To accommodate to this check if rate counters arealready allocated (by static allocator of BTS singleton for example) and register rate counter with different index. This fixes the tests for now but eventually we'll remove the BTS singleton which will allow us to remove this hack. Change-Id: I7c552ce653b44ec3a31049641728926adc07361d Related: OS#2757
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 341c9d42..e17399ac 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -218,8 +218,16 @@ BTS::BTS()
}
}
- m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
+ /* The static allocator might have already registered the counter group.
+ If this happens and we still called explicitly (in tests/* for example)
+ than just allocate the group with different index.
+ This shall be removed once weget rid of BTS singleton */
+ if (rate_ctr_get_group_by_name_idx(bts_ctrg_desc.group_name_prefix, 0))
+ m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 1);
+ else
+ m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
OSMO_ASSERT(m_ratectrs);
+
m_statg = osmo_stat_item_group_alloc(tall_pcu_ctx, &bts_statg_desc, 0);
OSMO_ASSERT(m_statg);
}