Skip to content

Commit

Permalink
fix: change ToSwarm::NewExternalAddrOfPeer return timing
Browse files Browse the repository at this point in the history
  • Loading branch information
wlynxg committed Oct 9, 2024
1 parent 58f77a5 commit e98e05d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions protocols/mdns/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ where
&mut self,
cx: &mut Context<'_>,
) -> Poll<ToSwarm<Self::ToSwarm, THandlerInEvent<Self>>> {
// If there are pending addresses to be emitted we emit them.
if let Some(event) = self.pending_events.pop_front() {
return Poll::Ready(event);
}

// Poll ifwatch.
while let Poll::Ready(Some(event)) = Pin::new(&mut self.if_watch).poll_next(cx) {
match event {
Expand Down Expand Up @@ -369,6 +364,12 @@ where
let event = Event::Discovered(discovered);
return Poll::Ready(ToSwarm::GenerateEvent(event));
}

// If there are pending addresses to be emitted we emit them.
if let Some(event) = self.pending_events.pop_front() {
return Poll::Ready(event);
}

// Emit expired event.
let now = Instant::now();
let mut closest_expiration = None;
Expand Down

0 comments on commit e98e05d

Please sign in to comment.