Skip to content

Commit 6095902

Browse files
committed
mdns: Set interval to missed tick delay
Signed-off-by: Alexandru Vasile <[email protected]>
1 parent b80f2ac commit 6095902

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/protocol/mdns.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,15 @@ impl Mdns {
138138
socket.join_multicast_v4(&IPV4_MULTICAST_ADDRESS, &Ipv4Addr::UNSPECIFIED)?;
139139
socket.set_nonblocking(true)?;
140140

141+
let mut query_interval = tokio::time::interval(config.query_interval);
142+
query_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
143+
141144
Ok(Self {
142145
_transport_handle,
143146
event_tx: config.tx,
144147
next_query_id: 1337u16,
145148
discovered: HashSet::new(),
146-
query_interval: tokio::time::interval(config.query_interval),
149+
query_interval,
147150
receive_buffer: vec![0u8; 4096],
148151
username: rand::thread_rng()
149152
.sample_iter(&Alphanumeric)

0 commit comments

Comments
 (0)