Skip to content

Commit

Permalink
Merge of #6923
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jun 14, 2023
2 parents 125b9b3 + 40e74dc commit fc8ae52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions zebra-network/src/peer_set/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,13 @@ where
let _guard = accept_span.enter();

debug!("got incoming connection");

// # Correctness
//
// Holding the drop guard returned by Span::enter across .await points will
// result in incorrect traces if it yields.
//
// This await is okay because the handshaker's `poll_ready` method always returns Ready.
handshaker.ready().await?;
// TODO: distinguish between proxied listeners and direct listeners
let handshaker_span = info_span!("listen_handshaker", peer = ?connected_addr);
Expand Down Expand Up @@ -638,6 +645,9 @@ where
handshakes.push(Box::pin(handshake_task));
}

// We need to drop the guard before yielding.
std::mem::drop(_guard);

// Rate-limit inbound connection handshakes.
// But sleep longer after a successful connection,
// so we can clear out failed connections at a higher rate.
Expand Down

0 comments on commit fc8ae52

Please sign in to comment.