mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 09:31:20 +00:00
fix(relay): send correct PeerId
to client in outbound STOP message
Previously, the relay server would erroneously send its own `PeerId` in the STOP message to the client upon an incoming relay connection. This is obviously wrong and results in failed connection upgrades in other implementations. Pull-Request: #3767.
This commit is contained in:
@ -520,7 +520,6 @@ impl NetworkBehaviour for Behaviour {
|
||||
event: Either::Left(handler::In::NegotiateOutboundConnect {
|
||||
circuit_id,
|
||||
inbound_circuit_req,
|
||||
relay_peer_id: self.local_peer_id,
|
||||
src_peer_id: event_source,
|
||||
src_connection_id: connection,
|
||||
}),
|
||||
|
@ -69,7 +69,6 @@ pub enum In {
|
||||
NegotiateOutboundConnect {
|
||||
circuit_id: CircuitId,
|
||||
inbound_circuit_req: inbound_hop::CircuitReq,
|
||||
relay_peer_id: PeerId,
|
||||
src_peer_id: PeerId,
|
||||
src_connection_id: ConnectionId,
|
||||
},
|
||||
@ -112,13 +111,11 @@ impl fmt::Debug for In {
|
||||
In::NegotiateOutboundConnect {
|
||||
circuit_id,
|
||||
inbound_circuit_req: _,
|
||||
relay_peer_id,
|
||||
src_peer_id,
|
||||
src_connection_id,
|
||||
} => f
|
||||
.debug_struct("In::NegotiateOutboundConnect")
|
||||
.field("circuit_id", circuit_id)
|
||||
.field("relay_peer_id", relay_peer_id)
|
||||
.field("src_peer_id", src_peer_id)
|
||||
.field("src_connection_id", src_connection_id)
|
||||
.finish(),
|
||||
@ -655,7 +652,6 @@ impl ConnectionHandler for Handler {
|
||||
In::NegotiateOutboundConnect {
|
||||
circuit_id,
|
||||
inbound_circuit_req,
|
||||
relay_peer_id,
|
||||
src_peer_id,
|
||||
src_connection_id,
|
||||
} => {
|
||||
@ -663,7 +659,7 @@ impl ConnectionHandler for Handler {
|
||||
.push_back(ConnectionHandlerEvent::OutboundSubstreamRequest {
|
||||
protocol: SubstreamProtocol::new(
|
||||
outbound_stop::Upgrade {
|
||||
relay_peer_id,
|
||||
src_peer_id,
|
||||
max_circuit_duration: self.config.max_circuit_duration,
|
||||
max_circuit_bytes: self.config.max_circuit_bytes,
|
||||
},
|
||||
|
@ -199,10 +199,7 @@ impl Handler {
|
||||
});
|
||||
|
||||
self.queued_events.push_back(ConnectionHandlerEvent::Custom(
|
||||
Event::InboundCircuitEstablished {
|
||||
src_peer_id: self.remote_peer_id,
|
||||
limit,
|
||||
},
|
||||
Event::InboundCircuitEstablished { src_peer_id, limit },
|
||||
));
|
||||
}
|
||||
Reservation::None => {
|
||||
|
@ -32,7 +32,7 @@ use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
|
||||
pub struct Upgrade {
|
||||
pub relay_peer_id: PeerId,
|
||||
pub src_peer_id: PeerId,
|
||||
pub max_circuit_duration: Duration,
|
||||
pub max_circuit_bytes: u64,
|
||||
}
|
||||
@ -55,7 +55,7 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for Upgrade {
|
||||
let msg = proto::StopMessage {
|
||||
type_pb: proto::StopMessageType::CONNECT,
|
||||
peer: Some(proto::Peer {
|
||||
id: self.relay_peer_id.to_bytes(),
|
||||
id: self.src_peer_id.to_bytes(),
|
||||
addrs: vec![],
|
||||
}),
|
||||
limit: Some(proto::Limit {
|
||||
|
Reference in New Issue
Block a user