Skip to content

Commit

Permalink
net:poll: Add log line when the reactor wakes up without commands
Browse files Browse the repository at this point in the history
This commit removes the debug assert since it occurs a few times.

Therefore, the debug assert is replaced with a warning log
line, allowing us to track the frequency of this occurrence.

Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Jun 25, 2023
1 parent 46b0775 commit dda1a47
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/poll/src/reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,12 @@ impl<Id: PeerId> nakamoto_net::Reactor<Id> for Reactor<net::TcpStream, Id> {
}
popol::Waker::reset(ev.source).ok();

// Nb. This assert has triggered once, but I wasn't available
// to reproduce it.
debug_assert!(!commands.is_empty());
// Nb. This should not happen, but it has been reported
// a few times. So we try to log a warning message and
// see how often this occurs.
if commands.is_empty() {
log::warn!(target: "poll", "waken up by waker received without commands");
}

for cmd in commands.try_iter() {
service.command_received(cmd);
Expand Down

0 comments on commit dda1a47

Please sign in to comment.