aboutsummaryrefslogtreecommitdiffstats
path: root/src/llc.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-02-26 20:05:33 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-03-02 12:05:06 +0100
commit5fc6e010a58409e73e19bd89b540f8c77bd8d397 (patch)
treed4b9246d93827c4d127767e328ed5396b4f2719c /src/llc.h
parent55f06c3d77563d5817107247c422d3e66115c352 (diff)
llc_queue::{dequeue,enqueue}() refactor
As seen in OS#4420, setting the MetaInfo.recv_time outside of llc_queue before calling llc_queue::enqueue() and later on using that value in llc_queue itself at dequeue time is not a good idea, since it can provoke errors if the recv_time was not set correctly. For instance, LlcTest was not setting the value for recv_time on some test, which ended up with a huge millisec value when substracting now() from it: """ llc.cpp:215:29: runtime error: signed integer overflow: 1582738663 * 1000 cannot be represented in type 'long int' """ This issue only appeared when started building on a raspberrypi4. Let's better set/store the MetaInfo.recv_time internally during llc_queue::enqueue(). Then, enqueue() only needs the MetaInfo.expire_time, so let's change its arg list to only receive that to avoid confusions. Take the chance to move the llc_queue APIs to use osmo_gettimeofday, since we need to fake the time now that the API itself sets that time. Also take the chance during this refactor to disallow passing null pointer by default since no user needs that. Finally, update the LlcTest accordingly with all API/behavior changes. Related: OS#4420 Change-Id: Ief6b1464dc779ff22adc2b02da7a006cd772ebce
Diffstat (limited to 'src/llc.h')
-rw-r--r--src/llc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/llc.h b/src/llc.h
index 2e7229ce..8667e003 100644
--- a/src/llc.h
+++ b/src/llc.h
@@ -75,7 +75,7 @@ struct gprs_llc_queue {
void init();
- void enqueue(struct msgb *llc_msg, const MetaInfo *info = 0);
+ void enqueue(struct msgb *llc_msg, const struct timeval *expire_time);
struct msgb *dequeue(const MetaInfo **info = 0);
void clear(BTS *bts);
void move_and_merge(gprs_llc_queue *o);