Merge pull request #1972 from ZcashFoundation/peer-set-demand-deadlock-doc

Document peer set deadlock resistance
This commit is contained in:
teor 2021-04-02 12:50:17 +10:00 committed by GitHub
parent 109ca4db86
commit 83b88f5b7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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