diff options
author | Alex Auvolat <alex@adnab.me> | 2021-02-17 17:43:07 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-02-17 17:43:07 +0100 |
commit | 6ccf3a84957c276320d229418f78ac23d58680c1 (patch) | |
tree | b737ac65123c7ce377ad0bad81d3dfcfcd69e0a4 /src/netapp.rs | |
parent | 9e38b82edcba5f60eb0ed95b5551947c0c03ba3c (diff) | |
download | netapp-6ccf3a84957c276320d229418f78ac23d58680c1.tar.gz netapp-6ccf3a84957c276320d229418f78ac23d58680c1.zip |
Add resilience when peer_addr() fails
Diffstat (limited to 'src/netapp.rs')
-rw-r--r-- | src/netapp.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/netapp.rs b/src/netapp.rs index eed0f59..0ddd447 100644 --- a/src/netapp.rs +++ b/src/netapp.rs @@ -210,7 +210,10 @@ impl NetApp { let (socket, _) = listener.accept().await.unwrap(); info!( "Incoming connection from {}, negotiating handshake...", - socket.peer_addr().unwrap() + match socket.peer_addr() { + Ok(x) => format!("{}", x), + Err(e) => format!("<invalid addr: {}>", e), + } ); let self2 = self.clone(); tokio::spawn(async move { |