ms: Move MS information merging to GprsMS

Currently the merging of the meta information (MS class, IMSI) takes
place in gprs_rlcmac_tbf::merge_and_clear_ms(). This makes it
difficult to merge the internal state and does not directly relate to
TBFs anyway.

This commit moves this into a new method GprsMs::merge_old_ms.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2015-08-18 11:55:03 +02:00
parent ebebad1c92
commit 2b349b5d33
5 changed files with 20 additions and 13 deletions

View File

@ -311,6 +311,20 @@ void GprsMs::reset()
m_imsi[0] = '\0';
}
void GprsMs::merge_old_ms(GprsMs *old_ms)
{
if (old_ms == this)
return;
if (strlen(imsi()) == 0 && strlen(old_ms->imsi()) != 0)
set_imsi(old_ms->imsi());
if (!ms_class() && old_ms->ms_class())
set_ms_class(old_ms->ms_class());
old_ms->reset();
}
void GprsMs::set_tlli(uint32_t tlli)
{
if (tlli == m_tlli || tlli == m_new_ul_tlli)

View File

@ -63,6 +63,8 @@ public:
void set_callback(Callback *cb) {m_cb = cb;}
void merge_old_ms(GprsMs *old_ms);
gprs_rlcmac_ul_tbf *ul_tbf() const {return m_ul_tbf;}
gprs_rlcmac_dl_tbf *dl_tbf() const {return m_dl_tbf;}
gprs_rlcmac_tbf *tbf(enum gprs_rlcmac_tbf_direction dir) const;

View File

@ -164,14 +164,6 @@ void gprs_rlcmac_tbf::merge_and_clear_ms(GprsMs *old_ms)
GprsMs::Guard guard_old(old_ms);
if (strlen(ms()->imsi()) == 0 && strlen(old_ms->imsi()) != 0) {
ms()->set_imsi(old_ms->imsi());
old_ms->set_imsi("");
}
if (!ms()->ms_class() && old_ms->ms_class())
ms()->set_ms_class(old_ms->ms_class());
/* Clean up the old MS object */
/* TODO: Use timer? */
if (old_ms->ul_tbf() && old_ms->ul_tbf()->T == 0) {
@ -197,7 +189,7 @@ void gprs_rlcmac_tbf::merge_and_clear_ms(GprsMs *old_ms)
}
}
old_ms->reset();
ms()->merge_old_ms(old_ms);
}
void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir)

View File

@ -230,7 +230,7 @@ int gprs_rlcmac_dl_tbf::handle(struct gprs_rlcmac_bts *bts,
if (ms_old->dl_tbf() && ms_old->dl_tbf()->T == 0)
tbf_free(ms_old->dl_tbf());
ms_old->reset();
ms->merge_old_ms(ms_old);
}
}

View File

@ -462,14 +462,13 @@ The MS object cannot fully confirm an unexpected TLLI: 0xf1000002, partly confir
Modifying MS object, TLLI = 0xf1000001, IMSI '' -> '001001000000001'
Modifying MS object, TLLI = 0xf1000001, IMSI '001001000000001' -> '001001000000002'
TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=FLOW) the IMSI '001001000000002' was already assigned to another MS object: TLLI = 0xf1000001, that IMSI will be removed
Modifying MS object, TLLI = 0xf1000002, IMSI '' -> '001001000000002'
Modifying MS object, TLLI = 0xf1000001, IMSI '001001000000002' -> ''
TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW) free
TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW), 1 TBFs, USFs = 00, TFIs = 00000002.
Detaching TBF from MS object, TLLI = 0xf1000001, TBF = TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW)
********** TBF ends here **********
Clearing MS object, TLLI: 0xf1000001, IMSI: ''
Modifying MS object, TLLI = 0xf1000002, IMSI '' -> '001001000000002'
Clearing MS object, TLLI: 0xf1000001, IMSI: '001001000000002'
Destroying MS object, TLLI = 0x00000000
TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=FLOW) free
TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=FLOW) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!