Skip to content

Commit

Permalink
Small readability improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Nov 29, 2024
1 parent 05fe824 commit 04c2e64
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions protocols/request-response/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,18 +708,11 @@ where
}
}

fn on_dial_failure(
&mut self,
DialFailure {
peer_id,
connection_id,
..
}: DialFailure,
) {
let key = if let Some(peer_id) = peer_id {
fn on_dial_failure(&mut self, failure: DialFailure) {
let key = if let Some(peer_id) = failure.peer_id {
peer_id.into()
} else {
connection_id.into()
failure.connection_id.into()
};

// If there are pending outgoing requests when a dial failure occurs,
Expand All @@ -732,7 +725,7 @@ where
for request in pending {
self.pending_events
.push_back(ToSwarm::GenerateEvent(Event::OutboundFailure {
peer: peer_id,
peer: failure.peer_id,
request_id: request.request_id,
error: OutboundFailure::DialFailure,
}));
Expand Down

0 comments on commit 04c2e64

Please sign in to comment.