aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-18 11:55:03 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-18 11:55:03 +0200
commit2b349b5d33050f6484c375e545ecb9f05a6be961 (patch)
treeb7969962b60bc2b0dd27f2c56e3dd8501ddb792b /src
parentebebad1c92e8bcbe28780b4d5ee2ac32091089ff (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/gprs_ms.cpp14
-rw-r--r--src/gprs_ms.h2
-rw-r--r--src/tbf.cpp10
-rw-r--r--src/tbf_dl.cpp2
4 files changed, 18 insertions, 10 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index b0481f3..a5a6cfd 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -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)
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index 7f85578..c490e7a 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -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;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 9f873dc..c63d7cc 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -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)
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 1bc08b7..a0510f6 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -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);
}
}