Skip to content

Commit

Permalink
fix: handle socket error on address query
Browse files Browse the repository at this point in the history
  • Loading branch information
Banyc committed Dec 19, 2024
1 parent 2bcaa96 commit 575cb76
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions protocol/src/stream/streams/tcp_mux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@ where
}
};
counter!("stream.tcp_mux.tcp.accepts").increment(1);
let addr = SocketAddrPair {
local_addr: stream.local_addr().unwrap(),
peer_addr: stream.peer_addr().unwrap(),
let addr = || -> io::Result<SocketAddrPair> {
Ok(SocketAddrPair {
local_addr: stream.local_addr()?,
peer_addr: stream.peer_addr()?,
})
};
let addr = match addr() {
Ok(addr) => addr,
Err(_) => {
continue;
}
};
let (r, w) = stream.into_split();
let (_, accepter) = spawn_mux_no_reconnection(r, w, server_mux_config(), &mut self.mux);
Expand Down

0 comments on commit 575cb76

Please sign in to comment.