mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-03 19:51:33 +00:00
libp2p_tcp: Ignore sockets without local/remote addr. (#1183)
The transport should be able to continue processing other connections. An error to determine a socket's address is not a fatal condition but may happen when a connection is immediately reset after being established. By the time the programme asks for the remote address, the socket may already be gone. Fixes #1182.
This commit is contained in:
committed by
Pierre Krieger
parent
6d5aa86cef
commit
6999c36d78
@ -50,7 +50,7 @@ use libp2p_core::{
|
||||
multiaddr::{Protocol, Multiaddr},
|
||||
transport::{ListenerEvent, TransportError}
|
||||
};
|
||||
use log::{debug, error, trace};
|
||||
use log::{debug, trace};
|
||||
use std::{
|
||||
collections::VecDeque,
|
||||
fmt,
|
||||
@ -448,16 +448,16 @@ impl Stream for TcpListenStream {
|
||||
let sock_addr = match sock.peer_addr() {
|
||||
Ok(addr) => addr,
|
||||
Err(err) => {
|
||||
error!("Failed to get peer address: {:?}", err);
|
||||
return Err(err)
|
||||
debug!("Failed to get peer address: {:?}", err);
|
||||
continue
|
||||
}
|
||||
};
|
||||
|
||||
let listen_addr = match sock.local_addr() {
|
||||
Ok(addr) => map_addr(&addr, &mut self.addrs, &mut self.pending, self.port)?,
|
||||
Err(err) => {
|
||||
error!("Failed to get local address of incoming socket: {:?}", err);
|
||||
return Err(err)
|
||||
debug!("Failed to get local address of incoming socket: {:?}", err);
|
||||
continue
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user