Move rate_ctr free to tbf subclass destructor
This way we clean up tbf_free entry point, and leave memory freeing for later on at the end when talloc_free is called. Change-Id: I1c45e3296e565725bcbbca391d9518772fffa89d
This commit is contained in:
parent
9dacf0b35b
commit
131deb059f
11
src/tbf.cpp
11
src/tbf.cpp
|
@ -164,6 +164,7 @@ gprs_rlcmac_tbf::~gprs_rlcmac_tbf()
|
|||
{
|
||||
osmo_fsm_inst_free(state_fsm.fi);
|
||||
state_fsm.fi = NULL;
|
||||
rate_ctr_group_free(m_ctrs);
|
||||
}
|
||||
|
||||
uint32_t gprs_rlcmac_tbf::tlli() const
|
||||
|
@ -269,19 +270,11 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
|
|||
{
|
||||
/* update counters */
|
||||
if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
|
||||
gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf);
|
||||
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_FREED);
|
||||
if (tbf->state_is(TBF_ST_FLOW))
|
||||
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_ABORTED);
|
||||
rate_ctr_group_free(ul_tbf->m_ul_egprs_ctrs);
|
||||
rate_ctr_group_free(ul_tbf->m_ul_gprs_ctrs);
|
||||
} else {
|
||||
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
|
||||
if (tbf->is_egprs_enabled()) {
|
||||
rate_ctr_group_free(dl_tbf->m_dl_egprs_ctrs);
|
||||
} else {
|
||||
rate_ctr_group_free(dl_tbf->m_dl_gprs_ctrs);
|
||||
}
|
||||
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_FREED);
|
||||
if (tbf->state_is(TBF_ST_FLOW))
|
||||
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_ABORTED);
|
||||
|
@ -297,8 +290,6 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
|
|||
if (tbf->ms())
|
||||
tbf->set_ms(NULL);
|
||||
|
||||
rate_ctr_group_free(tbf->m_ctrs);
|
||||
|
||||
LOGP(DTBF, LOGL_DEBUG, "********** %s-TBF ends here **********\n",
|
||||
(tbf->direction != GPRS_RLCMAC_UL_TBF) ? "DL" : "UL");
|
||||
talloc_free(tbf);
|
||||
|
|
|
@ -180,7 +180,12 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs
|
|||
gprs_rlcmac_dl_tbf::~gprs_rlcmac_dl_tbf()
|
||||
{
|
||||
osmo_timer_del(&m_llc_timer);
|
||||
/* ~gprs_rlcmac_dl_tbf() is called automatically upon return */
|
||||
if (is_egprs_enabled()) {
|
||||
rate_ctr_group_free(m_dl_egprs_ctrs);
|
||||
} else {
|
||||
rate_ctr_group_free(m_dl_gprs_ctrs);
|
||||
}
|
||||
/* ~gprs_rlcmac_tbf() is called automatically upon return */
|
||||
}
|
||||
|
||||
gprs_rlcmac_dl_tbf::gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms) :
|
||||
|
|
|
@ -91,6 +91,13 @@ static const struct rate_ctr_group_desc tbf_ul_egprs_ctrg_desc = {
|
|||
tbf_ul_egprs_ctr_description,
|
||||
};
|
||||
|
||||
gprs_rlcmac_ul_tbf::~gprs_rlcmac_ul_tbf()
|
||||
{
|
||||
rate_ctr_group_free(m_ul_egprs_ctrs);
|
||||
rate_ctr_group_free(m_ul_gprs_ctrs);
|
||||
/* ~gprs_rlcmac_tbf() is called automatically upon return */
|
||||
}
|
||||
|
||||
static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf)
|
||||
{
|
||||
tbf->~gprs_rlcmac_ul_tbf();
|
||||
|
|
|
@ -54,6 +54,7 @@ enum tbf_egprs_ul_counters {
|
|||
|
||||
struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf {
|
||||
gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms);
|
||||
~gprs_rlcmac_ul_tbf();
|
||||
gprs_rlc_window *window();
|
||||
struct msgb *create_ul_ack(uint32_t fn, uint8_t ts);
|
||||
bool ctrl_ack_to_toggle();
|
||||
|
|
Loading…
Reference in New Issue