aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 15:19:39 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 15:19:39 +0100
commit985fd114f243dfe5095cd2d5e90bf4f0c0a760a5 (patch)
tree0bbd43ac6b87edbb26b51c9d4e6d49bb9c5b9692 /src
parentfce431cf3acfcce343dd456d801f7ab0921ff9d2 (diff)
llc: Change the flow. Exit early for the special case and initialize the tv
Diffstat (limited to 'src')
-rw-r--r--src/llc.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/llc.cpp b/src/llc.cpp
index 585f656..19bf66a 100644
--- a/src/llc.cpp
+++ b/src/llc.cpp
@@ -85,14 +85,17 @@ void gprs_llc::calc_pdu_lifetime(BTS *bts, const uint16_t pdu_delay_csec, struct
delay_csec = pdu_delay_csec;
/* keep timestap at 0 for infinite delay */
- if (delay_csec != 0xffff) {
- /* calculate timestamp of timeout */
- gettimeofday(tv, NULL);
- tv->tv_usec += (delay_csec % 100) * 10000;
- tv->tv_sec += delay_csec / 100;
- if (tv->tv_usec > 999999) {
- tv->tv_usec -= 1000000;
- tv->tv_sec++;
- }
+ if (delay_csec == 0xffff) {
+ memset(tv, 0, sizeof(*tv));
+ return;
+ }
+
+ /* calculate timestamp of timeout */
+ gettimeofday(tv, NULL);
+ tv->tv_usec += (delay_csec % 100) * 10000;
+ tv->tv_sec += delay_csec / 100;
+ if (tv->tv_usec > 999999) {
+ tv->tv_usec -= 1000000;
+ tv->tv_sec++;
}
}