Change in osmo-pcu[master]: Put dl_tbf::cleanup into destructor

pespin gerrit-no-reply at lists.osmocom.org
Mon Aug 23 16:28:07 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25050 )

Change subject: Put dl_tbf::cleanup into destructor
......................................................................

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
---
M src/tbf.cpp
M src/tbf_dl.cpp
M src/tbf_dl.h
3 files changed, 7 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve



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);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/25050
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ia2aaa43bd8faacf09fe4b36b11b38022bea7a59c
Gerrit-Change-Number: 25050
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210823/d4b006a0/attachment.htm>


More information about the gerrit-log mailing list