From: Ralph Ronnquist Date: Tue, 26 Oct 2021 22:21:35 +0000 (+1100) Subject: Bug fix: flip-over limits are in microseconds. X-Git-Tag: 1.5.1~1 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=e8cbd15f0a2d8492b5b0eaa16fb0602483b4d91a;p=rrq%2Frrqnet.git Bug fix: flip-over limits are in microseconds. --- diff --git a/rrqnet.c b/rrqnet.c index db93fd7..6b57d08 100644 --- a/rrqnet.c +++ b/rrqnet.c @@ -99,10 +99,10 @@ typedef struct _ReaderData { #define TIME_MICROS(TM) (((int64_t) (TM)->tv_sec * 1000000) + (TM)->tv_usec ) #define DIFF_MICROS(TM1,TM2) ( TIME_MICROS(TM1) - TIME_MICROS(TM2) ) -// RECENT(T,M) is the time logic for requiring a gap time (in +// RECENT_MICROS(T,M) is the time logic for requiring a gap time (in // milliseconds) before shifting a MAC to a new remote. The limit is -// 6000 for broadcast and 20000 for unicast. -#define RECENT(T,M) ((M) < ((T)? 6000 : 20000 )) +// 6s for broadcast and 20s for unicast. +#define RECENT_MICROS(T,M) ((M) < ((T)? 6000000 : 20000000 )) // VERYOLD_MICROSS is used for discarding downlink remotes whose latest // activity is older than this. @@ -1058,10 +1058,10 @@ static struct Interface *input_check( // The packet source MAC has arrived on other than its // previous channel. It thus gets dropped if tap/stdin is the // primary channel, or the time since the last packet for that - // interface is less than RECENT, with different limits for - // broadcast and unicast. + // interface is less than RECENT_MICROS, with different limits + // for broadcast and unicast. int64_t dmac = DIFF_MICROS( &now, &x->rec_when); - if ( x->remote->spec == 0 || RECENT( *buf & 1, dmac ) ) { + if ( x->remote->spec == 0 || RECENT_MICROS( *buf & 1, dmac ) ) { if ( verbose >= 2 ) { fprintf( stderr,