diff --git a/protocols/relay/src/transport.rs b/protocols/relay/src/transport.rs index 1d5ff1bf57b..4aa96f69933 100644 --- a/protocols/relay/src/transport.rs +++ b/protocols/relay/src/transport.rs @@ -401,14 +401,12 @@ impl Stream for RelayListener { Poll::Ready(Some(BehaviourToListenerMsg::IncomingRelayedConnection { stream, src_peer_id, - relay_peer_id, relay_addr, + relay_peer_id: _ })) => { return Poll::Ready(Some(Ok(ListenerEvent::Upgrade { upgrade: RelayedListenerUpgrade::Relayed(Some(stream)), - local_addr: relay_addr - .with(Protocol::P2p(relay_peer_id.into())) - .with(Protocol::P2pCircuit), + local_addr: relay_addr.with(Protocol::P2pCircuit), remote_addr: Protocol::P2p(src_peer_id.into()).into(), }))); } diff --git a/protocols/relay/tests/lib.rs b/protocols/relay/tests/lib.rs index 70584d8a62b..a215d7ffad5 100644 --- a/protocols/relay/tests/lib.rs +++ b/protocols/relay/tests/lib.rs @@ -381,9 +381,10 @@ fn src_try_connect_to_offline_dst() { loop { match src_swarm.next_event().await { - SwarmEvent::UnknownPeerUnreachableAddr { address, .. } + SwarmEvent::UnreachableAddr { address, peer_id, .. } if address == dst_addr_via_relay => { + assert_eq!(peer_id, dst_peer_id); break; } SwarmEvent::Behaviour(CombinedEvent::Ping(_)) => {} @@ -437,9 +438,10 @@ fn src_try_connect_to_unsupported_dst() { loop { match src_swarm.next_event().await { - SwarmEvent::UnknownPeerUnreachableAddr { address, .. } + SwarmEvent::UnreachableAddr { address, peer_id, .. } if address == dst_addr_via_relay => { + assert_eq!(peer_id, dst_peer_id); break; } SwarmEvent::ConnectionClosed { peer_id, .. } if peer_id == relay_peer_id => {} @@ -486,8 +488,10 @@ fn src_try_connect_to_offline_dst_via_offline_relay() { // Source Node fail to reach Destination Node due to failure reaching Relay. match src_swarm.next_event().await { - SwarmEvent::UnknownPeerUnreachableAddr { address, .. } - if address == dst_addr_via_relay => {} + SwarmEvent::UnreachableAddr { address, peer_id, .. } + if address == dst_addr_via_relay => { + assert_eq!(peer_id, dst_peer_id); + } e => panic!("{:?}", e), } }); @@ -573,6 +577,9 @@ fn firewalled_src_discover_firewalled_dst_via_kad_and_connect_to_dst_via_routabl } } SwarmEvent::Behaviour(CombinedEvent::Ping(_)) => {} + SwarmEvent::Behaviour(CombinedEvent::Kad(KademliaEvent::RoutingUpdated { + .. + })) => {} e => panic!("{:?}", e), } } @@ -1005,9 +1012,10 @@ fn yield_incoming_connection_through_correct_listener() { } match src_3_swarm.next_event().boxed().poll_unpin(cx) { - Poll::Ready(SwarmEvent::UnknownPeerUnreachableAddr { address, .. }) + Poll::Ready(SwarmEvent::UnreachableAddr { address, peer_id, .. }) if address == dst_addr_via_relay_3 => { + assert_eq!(peer_id, dst_peer_id); return Poll::Ready(()); } Poll::Ready(SwarmEvent::Dialing { .. }) => {}