aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_ms.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-08 12:13:08 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-20 11:31:07 +0200
commitfecece0e59ab5ff705887a1247df6e02836d7c66 (patch)
tree1359a27a39d5474981b6aa24bdffcff064c9be5b /src/gprs_ms.cpp
parente04e0b0a20fb2b93855de0106873c90a88c53052 (diff)
tbf: Add MS object management to TBF code
This commit adds MS object creation and cleanup to the TBF related code. MS objects are created when a TBF that has been "anonymous" so far gets associated with a TLLI. When a TBF is replaced by another, the old TBF is detached and the new one is attached to the MS. When all TBFs have been detached, the MS object gets deleted. The TBF related code should not call attach_tbf/detach_tbf directly but use set_ms instead to make sure, that the references are updated properly. GprsMs::detach_tbf also calls set_ms(NULL) on the detached TBF object. The MS object is not really used yet, the focus is still on object creation, TBF association, and cleanup. Ticket: #1674 Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gprs_ms.cpp')
-rw-r--r--src/gprs_ms.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index db29d206..d9d74f4d 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -67,6 +67,16 @@ GprsMs::GprsMs(uint32_t tlli) :
GprsMs::~GprsMs()
{
LOGP(DRLCMAC, LOGL_INFO, "Destroying MS object, TLLI = 0x%08x\n", tlli());
+
+ if (m_ul_tbf) {
+ m_ul_tbf->set_ms(NULL);
+ m_ul_tbf = NULL;
+ }
+
+ if (m_dl_tbf) {
+ m_dl_tbf->set_ms(NULL);
+ m_dl_tbf = NULL;
+ }
}
void* GprsMs::operator new(size_t size)
@@ -148,6 +158,9 @@ void GprsMs::detach_tbf(gprs_rlcmac_tbf *tbf)
LOGP(DRLCMAC, LOGL_INFO, "Detaching TBF from MS object, TLLI = 0x%08x, TBF = %s\n",
tlli(), tbf->name());
+ if (tbf->ms() == this)
+ tbf->set_ms(NULL);
+
update_status();
}