From 1be93d4682baa5e2a166ebc940f894e68354ac16 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 16 Feb 2018 21:32:21 +0100 Subject: [PATCH] add RLC UM destructor --- lib/include/srslte/upper/rlc_um.h | 1 + lib/src/upper/rlc_um.cc | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/include/srslte/upper/rlc_um.h b/lib/include/srslte/upper/rlc_um.h index 0a2469a7c..6d8eb6d08 100644 --- a/lib/include/srslte/upper/rlc_um.h +++ b/lib/include/srslte/upper/rlc_um.h @@ -50,6 +50,7 @@ class rlc_um { public: rlc_um(); + ~rlc_um(); void init(log *rlc_entity_log_, uint32_t lcid_, diff --git a/lib/src/upper/rlc_um.cc b/lib/src/upper/rlc_um.cc index 213e8c840..a365a4501 100644 --- a/lib/src/upper/rlc_um.cc +++ b/lib/src/upper/rlc_um.cc @@ -59,6 +59,11 @@ rlc_um::rlc_um() : tx_sdu_queue(16) pdu_lost = false; } +rlc_um::~rlc_um() +{ + stop(); +} + void rlc_um::init(srslte::log *log_, uint32_t lcid_, srsue::pdcp_interface_rlc *pdcp_, @@ -114,12 +119,13 @@ void rlc_um::empty_queue() { void rlc_um::stop() { reset(); - mac_timers->timer_release_id(reordering_timer_id); + if (mac_timers) { + mac_timers->timer_release_id(reordering_timer_id); + } } void rlc_um::reset() { - // Empty tx_sdu_queue before locking the mutex empty_queue(); @@ -129,12 +135,17 @@ void rlc_um::reset() vr_ux = 0; vr_uh = 0; pdu_lost = false; - if(rx_sdu) - rx_sdu->reset(); - if(tx_sdu) - tx_sdu->reset(); - if(mac_timers) + if(rx_sdu) { + pool->deallocate(rx_sdu); + } + + if(tx_sdu) { + pool->deallocate(tx_sdu); + } + + if(mac_timers) { reordering_timer->stop(); + } // Drop all messages in RX window std::map::iterator it;