Skip to content

Commit f2b5b60

Browse files
Correct orphans detection (#131)
Set default is_queue_empty to true Set linux timeout for garbage collect to 5s
1 parent 2a0b629 commit f2b5b60

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: lib/platform/linux/platform.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define POLLING_INTERVAL_MS 20
2626

2727
// Wakeup timeout for dispatch thread, mainly for garbage collection of fragments
28-
#define DISPATCH_WAKEUP_TIMEOUT_MS 5000
28+
#define DISPATCH_WAKEUP_TIMEOUT_S 5
2929

3030
// Mutex for sending, ie serial access
3131
static pthread_mutex_t sending_mutex;
@@ -106,7 +106,7 @@ static void * dispatch_indication(void * unused)
106106
{
107107
// Queue is empty, wait
108108
clock_gettime(CLOCK_REALTIME, &ts);
109-
ts.tv_sec += DISPATCH_WAKEUP_TIMEOUT_MS ; // 5 second timeout
109+
ts.tv_sec += DISPATCH_WAKEUP_TIMEOUT_S ; // 5 second timeout
110110
pthread_cond_timedwait(&m_queue_not_empty_cond, &m_queue_mutex, &ts);
111111

112112
// Force a garbage collect (to be sure it's called even if no frag are received)

Diff for: lib/wpc/reassembly/reassembly.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static full_packet_t * m_packets = NULL;
6464

6565
// Keep track of the queue emptyness, to get info from other tasks
6666
// True indicate that queue is empty, false indicate that queue is most probably not empty
67-
static bool m_is_queue_empty;
67+
static bool m_is_queue_empty = true;
6868

6969
// Timestamp of last garbage collect
7070
static unsigned long long m_last_gc_ts_ms;

0 commit comments

Comments
 (0)