aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 15:35:45 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 15:35:45 +0100
commit51e093bd1cbe6d91278f72c82fbd54711e4a9ede (patch)
tree7fd0dd0e0ae27464761eb8e5407d3522d510aeb3 /src/tbf.cpp
parent985fd114f243dfe5095cd2d5e90bf4f0c0a760a5 (diff)
llc: Use timeradd and timercmp and fix for < 1s PDU llc timeouts
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r--src/tbf.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 25f31c31..2310f855 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -687,10 +687,11 @@ struct msgb *gprs_rlcmac_tbf::llc_dequeue(bssgp_bvc_ctx *bctx)
while ((msg = m_llc.dequeue())) {
tv = (struct timeval *)msg->data;
msgb_pull(msg, sizeof(*tv));
- if (tv->tv_sec /* not infinite */
- && (tv_now.tv_sec > tv->tv_sec /* and secs expired */
- || (tv_now.tv_sec == tv->tv_sec /* .. or if secs equal .. */
- && tv_now.tv_usec > tv->tv_usec))) { /* .. usecs expired */
+
+ /* Timeout is infinite */
+ if (tv->tv_sec == 0 && tv->tv_usec == 0)
+ break;
+ if (timercmp(&tv_now, tv, >)) {
LOGP(DRLCMACDL, LOGL_NOTICE, "%s Discarding LLC PDU "
"because lifetime limit reached\n",
tbf_name(this));