mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 09:41:34 +00:00
Replace listen_addr
with local_addr
. (#1223)
* Replace `listen_addr` with `local_addr`. In `ListenerUpgrade`, `ConnectedPoint` and other event types where we were previously using the listen address we now report the local address of an incoming connection. The reason being that it is difficult to get the listen address right. In case clients want to know, which listener produced an incoming connection upgrade they are advised to use the `ListenerId` for such purposes. * Update transports/tcp/src/lib.rs Co-Authored-By: Max Inden <mail@max-inden.de>
This commit is contained in:
committed by
Pierre Krieger
parent
56c14071d8
commit
9793c42859
@ -88,7 +88,7 @@ fn num_incoming_negotiated() {
|
||||
ListenerEvent::NewAddress("/ip4/127.0.0.1/tcp/1234".parse().unwrap()),
|
||||
ListenerEvent::Upgrade {
|
||||
upgrade: (peer_id.clone(), muxer.clone()),
|
||||
listen_addr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
|
||||
local_addr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
|
||||
remote_addr: "/ip4/127.0.0.1/tcp/32111".parse().unwrap()
|
||||
}
|
||||
];
|
||||
@ -399,7 +399,7 @@ fn limit_incoming_connections() {
|
||||
events.extend(std::iter::repeat(
|
||||
ListenerEvent::Upgrade {
|
||||
upgrade: (peer_id.clone(), muxer.clone()),
|
||||
listen_addr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
|
||||
local_addr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
|
||||
remote_addr: "/ip4/127.0.0.1/tcp/32111".parse().unwrap()
|
||||
}
|
||||
).take(10));
|
||||
|
Reference in New Issue
Block a user