diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-05-21 16:58:22 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-05-27 13:30:01 +0200 |
commit | 0e50ce614569b9ae7bcc6e7becc4aeec46e8369d (patch) | |
tree | 71ce7ecfc92c291cd2362036b0d2df343ffb448b /src/tbf.cpp | |
parent | 767193e20b4172dfb0e76ec63444115dc5ae8806 (diff) |
tbf: Always call set_tlli/confirm_tlli in update_ms
Currently the m_tlli member in GprsMs is set by the constructor,
circumventing the TLLI confirmation mechanism.
This commit replaces the get_or_create_ms() method by a create_ms()
method which takes the TLLI and the direction (UL or DL) as
parameters to select either set_tlli() or confirm_tlli(). The MS
object is instantiated with TLLI = 0, and therefore GprsMs::tlli() is
extended to return the DL TLLI if both of the other TLLI are not set.
Note that create_ms() will not check whether an MS object with a
matching TLLI is already stored in the list, so it should only be
called after a corresponding get_ms() in general.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r-- | src/tbf.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp index 8f8e5385..51b2aa5c 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -98,9 +98,16 @@ void gprs_rlcmac_tbf::set_ms(GprsMs *ms) void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir) { - if (!ms()) - set_ms(bts->ms_store().get_or_create_ms(tlli)); - else if (dir == GPRS_RLCMAC_UL_TBF) + if (!ms()) { + GprsMs *new_ms = bts->ms_store().get_ms(tlli); + if (!new_ms) + new_ms = bts->ms_store().create_ms(tlli, dir); + + set_ms(new_ms); + return; + } + + if (dir == GPRS_RLCMAC_UL_TBF) ms()->set_tlli(tlli); else ms()->confirm_tlli(tlli); |