Skip to content

Commit

Permalink
Merge pull request #1972 from ZcashFoundation/peer-set-demand-deadloc…
Browse files Browse the repository at this point in the history
…k-doc

Document peer set deadlock resistance
  • Loading branch information
teor2345 committed Apr 2, 2021
1 parent 109ca4d commit 83b88f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zebra-network/src/peer_set/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,14 @@ where
self.update_metrics();

if self.preselected_p2c_index.is_none() {
// CORRECTNESS
//
// If the channel is full, drop the demand signal rather than waiting.
// If we waited here, the crawler could deadlock sending a request to
// fetch more peers, because it also empties the channel.
trace!("no ready services, sending demand signal");
let _ = self.demand_signal.try_send(());

// CORRECTNESS
//
// The current task must be scheduled for wakeup every time we
Expand Down

0 comments on commit 83b88f5

Please sign in to comment.