Skip to content

Commit

Permalink
protocols/relay/: Only emit CircuitEstablished when transport notified
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Jan 14, 2022
1 parent 80a9e76 commit b1cb684
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions protocols/relay/src/v2/client/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ impl ProtocolsHandler for Handler {
info: Self::OutboundOpenInfo,
) {
match (output, info) {
// Outbound reservation
(
outbound_hop::Output::Reservation {
renewal_timeout,
Expand All @@ -286,6 +287,8 @@ impl ProtocolsHandler for Handler {
self.queued_events
.push_back(ProtocolsHandlerEvent::Custom(event));
}

// Outbound circuit
(
outbound_hop::Output::Circuit {
substream,
Expand All @@ -300,18 +303,21 @@ impl ProtocolsHandler for Handler {
read_buffer,
tx,
))) {
Ok(()) => self.alive_lend_out_substreams.push(rx),
Ok(()) => {
self.alive_lend_out_substreams.push(rx);
self.queued_events.push_back(ProtocolsHandlerEvent::Custom(
Event::OutboundCircuitEstablished { limit },
));
},
Err(_) => debug!(
"Oneshot to `RelayedDial` future dropped. \
Dropping established relayed connection to {:?}.",
self.remote_peer_id,
),
}

self.queued_events.push_back(ProtocolsHandlerEvent::Custom(
Event::OutboundCircuitEstablished { limit },
));
}

_ => unreachable!(),
}
}
Expand Down

0 comments on commit b1cb684

Please sign in to comment.