Skip to content

Commit ca6c4b0

Browse files
committedDec 2, 2020
Check for ntp clock shift when scheduling next beacon. Otherwise direwolf continuously transmits all beacons until it's caught up with the new system clock, which could be days.
1 parent 8ac14f8 commit ca6c4b0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/beacon.c

+8
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,14 @@ static void * beacon_thread (void *arg)
614614
/* i.e. Don't take relative to now in case there was some delay. */
615615

616616
bp->next += bp->every;
617+
618+
/* craigerl: if next beacon is scheduled in the past, then set next beacon relative to now (happens when NTP pushes clock AHEAD) */
619+
/* fixme: if NTP sets clock BACK an hour, this thread will sleep for that hour */
620+
if ( bp->next < now ) {
621+
bp->next = now + bp->every;
622+
dw_printf("\nSystem clock appears to have jumped forward. Beacon schedule updated.\n\n");
623+
}
624+
617625
}
618626

619627
} /* if time to send it */

0 commit comments

Comments
 (0)