Skip to content

Commit

Permalink
Correct orphans detection
Browse files Browse the repository at this point in the history
Set default is_queue_empty to true
Set linux timeout for garbage collect to 5s
  • Loading branch information
StephaneTriomphe committed Jan 28, 2025
1 parent 2a0b629 commit d87b863
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/platform/linux/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define POLLING_INTERVAL_MS 20

// Wakeup timeout for dispatch thread, mainly for garbage collection of fragments
#define DISPATCH_WAKEUP_TIMEOUT_MS 5000
#define DISPATCH_WAKEUP_TIMEOUT_S 5

// Mutex for sending, ie serial access
static pthread_mutex_t sending_mutex;
Expand Down Expand Up @@ -106,7 +106,7 @@ static void * dispatch_indication(void * unused)
{
// Queue is empty, wait
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += DISPATCH_WAKEUP_TIMEOUT_MS ; // 5 second timeout
ts.tv_sec += DISPATCH_WAKEUP_TIMEOUT_S ; // 5 second timeout
pthread_cond_timedwait(&m_queue_not_empty_cond, &m_queue_mutex, &ts);

// Force a garbage collect (to be sure it's called even if no frag are received)
Expand Down
2 changes: 1 addition & 1 deletion lib/wpc/reassembly/reassembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static full_packet_t * m_packets = NULL;

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

// Timestamp of last garbage collect
static unsigned long long m_last_gc_ts_ms;
Expand Down

0 comments on commit d87b863

Please sign in to comment.