From 4c9b12610e4e92576b9cb2af83569f53970daae5 Mon Sep 17 00:00:00 2001 From: Sudo Dios Date: Wed, 11 Sep 2024 17:29:25 +0330 Subject: [PATCH] Reuse address in bind socket --- src/http/tcp_socket.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/http/tcp_socket.rs b/src/http/tcp_socket.rs index a54f37c..2292efd 100644 --- a/src/http/tcp_socket.rs +++ b/src/http/tcp_socket.rs @@ -20,6 +20,7 @@ impl TcpSocket { if !tcp_addr.is_only_v6 { socket.set_only_v6(false)?; } + socket.set_reuse_address(true)?; socket.bind(&tcp_addr.sock_addr.into())?; socket.listen(128)?; let tcp_listener = TcpListener::from_std(socket.into())?;