Put dl_tbf::cleanup into destructor
It's fine to always attemt dropping the timer since it's set up in the
constructor.
This also drps the double function call abort()+cleanup() which is
confusing.
Change-Id: Ia2aaa43bd8faacf09fe4b36b11b38022bea7a59c
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 6ed8e3d..42575d6 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -293,7 +293,6 @@
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
dl_tbf->abort();
- dl_tbf->cleanup();
}
LOGPTBF(tbf, LOGL_INFO, "free\n");
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index f264cfc..2154ed6 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -177,6 +177,12 @@
return tbf;
}
+gprs_rlcmac_dl_tbf::~gprs_rlcmac_dl_tbf()
+{
+ osmo_timer_del(&m_llc_timer);
+ /* ~gprs_rlcmac_dl_tbf() is called automatically upon return */
+}
+
gprs_rlcmac_dl_tbf::gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms) :
gprs_rlcmac_tbf(bts_, ms, GPRS_RLCMAC_DL_TBF),
m_tx_counter(0),
@@ -191,11 +197,6 @@
osmo_timer_setup(&m_llc_timer, llc_timer_cb, this);
}
-void gprs_rlcmac_dl_tbf::cleanup()
-{
- osmo_timer_del(&m_llc_timer);
-}
-
void gprs_rlcmac_dl_tbf::start_llc_timer()
{
if (the_pcu->vty.llc_idle_ack_csec > 0) {
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index af82a0c..6fddeb5 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -42,8 +42,8 @@
struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms);
+ ~gprs_rlcmac_dl_tbf();
gprs_rlc_window *window();
- void cleanup();
int append_data(uint16_t pdu_delay_csec,
const uint8_t *data, uint16_t len);