1
0

fix: add set_reuse_address to prevent bind error

When the client restarts, some socks clients' connections stay in the `FIN-WAIT` state. Which prevents the client from going up again immediately.
This commit is contained in:
雷宇辰 2022-10-27 18:00:38 +08:00 committed by EAimTY
parent 0303155b28
commit f5834b47c4

View File

@ -38,6 +38,7 @@ impl Socks5 {
} else {
let socket = Socket::new(Domain::IPV6, Type::STREAM, Some(Protocol::TCP))?;
socket.set_only_v6(false)?;
socket.set_reuse_address(true)?;
socket.bind(&SockAddr::from(local_addr))?;
socket.listen(128)?;
TcpListener::from_std(StdTcpListener::from(socket))?