aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-02 13:01:35 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-06 19:28:08 +0100
commit1842c921b3ed5c941a092542b922274c535111a9 (patch)
tree7f55de115683338104308f7f5ed938d713ed4ad1 /src/tbf.cpp
parentadcdf150a63b3fe13dd933fca9f51974f40aeede (diff)
tbf: Reduce m_new_tbf logging messages
Currently tbf->m_new_tbf may point to itself if no new TBF is assigned. But this leads to additional logging messages, since the code in set_new_tbf and tbf_free assumes, that a real new TBF is assigned and generates log messages accordingly. This commit adds checks to avoid those messages in the above case. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r--src/tbf.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 6f4f15c7..388f82d7 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -55,15 +55,16 @@ void gprs_rlcmac_tbf::set_new_tbf(gprs_rlcmac_tbf *tbf)
{
if (m_new_tbf) {
if (m_new_tbf == tbf) {
- LOGP(DRLCMAC, LOGL_NOTICE,
+ LOGP(DRLCMAC, LOGL_INFO,
"%s reassigning %s to m_new_tbf\n",
tbf_name(this), tbf_name(tbf));
return;
}
- LOGP(DRLCMAC, LOGL_NOTICE,
- "%s m_new_tbf is already assigned to %s, "
- "overwriting the old value with %s\n",
- tbf_name(this), tbf_name(m_new_tbf), tbf_name(tbf));
+ if (m_new_tbf != this)
+ LOGP(DRLCMAC, LOGL_NOTICE,
+ "%s m_new_tbf is already assigned to %s, "
+ "overwriting the old value with %s\n",
+ tbf_name(this), tbf_name(m_new_tbf), tbf_name(tbf));
/* Detach from other TBF */
m_new_tbf->m_old_tbf = NULL;
}
@@ -154,25 +155,33 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
tbf->bts->tbf_dl_freed();
if (tbf->m_old_tbf) {
- LOGP(DRLCMAC, LOGL_INFO, "%s Old TBF %s still exists, detaching\n",
- tbf_name(tbf), tbf_name(tbf->m_old_tbf));
- if (tbf->m_old_tbf->m_new_tbf == tbf)
+ if (tbf->m_old_tbf == tbf) {
+ /* points to itself, ignore */
+ } else if (tbf->m_old_tbf->m_new_tbf == tbf) {
+ LOGP(DRLCMAC, LOGL_INFO,
+ "%s Old TBF %s still exists, detaching\n",
+ tbf_name(tbf), tbf_name(tbf->m_old_tbf));
tbf->m_old_tbf->m_new_tbf = NULL;
- else
+ } else {
LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: "
"tbf->m_old_tbf->m_new_tbf != tbf\n",
tbf_name(tbf));
+ }
}
if (tbf->m_new_tbf) {
- LOGP(DRLCMAC, LOGL_INFO, "%s New TBF %s still exists, detaching\n",
- tbf_name(tbf), tbf_name(tbf->m_new_tbf));
- if (tbf->m_new_tbf->m_old_tbf == tbf)
+ if (tbf->m_new_tbf == tbf) {
+ /* points to itself, ignore */
+ } else if (tbf->m_new_tbf->m_old_tbf == tbf) {
+ LOGP(DRLCMAC, LOGL_INFO,
+ "%s New TBF %s still exists, detaching\n",
+ tbf_name(tbf), tbf_name(tbf->m_new_tbf));
tbf->m_new_tbf->m_old_tbf = NULL;
- else
+ } else {
LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: "
"tbf->m_new_tbf->m_old_tbf != tbf\n",
tbf_name(tbf));
+ }
}
LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF ends here **********\n");