defrag: use 'struct timeval' for timeout tracking

Until now the time out handling in defrag was done using a single
uint32_t that tracked seconds. This lead to corner cases, where
defrag trackers could be timed out a little too early.
pull/1088/head
Victor Julien 11 years ago
parent 7c05685421
commit 2b84cd9483

@ -53,7 +53,7 @@ static int DefragTrackerTimedOut(DefragTracker *dt, struct timeval *ts)
}
/* retain if remove is not set and not timed out */
if (!dt->remove && dt->timeout > (uint32_t)ts->tv_sec)
if (!dt->remove && timercmp(&dt->timeout, ts, >))
return 0;
return 1;

@ -579,7 +579,8 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
}
/* Update timeout. */
tracker->timeout = p->ts.tv_sec + tracker->host_timeout;
tracker->timeout.tv_sec = p->ts.tv_sec + tracker->host_timeout;
tracker->timeout.tv_usec = p->ts.tv_usec;
Frag *prev = NULL, *next;
int overlap = 0;

@ -110,7 +110,7 @@ typedef struct DefragTracker_ {
Address src_addr; /**< Source address for this tracker. */
Address dst_addr; /**< Destination address for this tracker. */
uint32_t timeout; /**< When this tracker will timeout. */
struct timeval timeout; /**< When this tracker will timeout. */
uint32_t host_timeout; /**< Host timeout, statically assigned from the yaml */
/** use cnt, reference counter */

Loading…
Cancel
Save