From f5834b47c496fc7d014d029ae8c24cc688917747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E5=AE=87=E8=BE=B0?= <6648049+TooYoungTooSimp@users.noreply.github.com> Date: Thu, 27 Oct 2022 18:00:38 +0800 Subject: [PATCH] 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. --- client/src/socks5/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/socks5/mod.rs b/client/src/socks5/mod.rs index b7ec5e6..091af9c 100644 --- a/client/src/socks5/mod.rs +++ b/client/src/socks5/mod.rs @@ -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))?