Skip to content

Commit

Permalink
Fix beacon tick sleep update (#469)
Browse files Browse the repository at this point in the history
This fixes the beacon tick causing endless beacons
  • Loading branch information
madninja authored Oct 20, 2023
1 parent 6ef7cd0 commit 76093c9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/beaconer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ impl Beaconer {
// Check if beaconing is enabled and we have valid region params
if !self.disabled && self.region_params.check_valid().is_ok() {
self.handle_beacon_tick().await;
} else {
// otherwise sleep for another interval period
next_beacon_instant = Instant::now() + self.interval;
}
// sleep up to another interval period. A subsequent region
// param update will adjust this beack to a random offset in
// the next valid window
next_beacon_instant = Instant::now() + self.interval;
},
message = self.messages.recv() => match message {
Some(Message::ReceivedBeacon(packet)) => self.handle_received_beacon(packet).await,
Expand Down

0 comments on commit 76093c9

Please sign in to comment.