[Tarantool-patches] [PATCH v1 3/4] test: enable SO_REUSEADDR on socket in httpd.py
sergeyb at tarantool.org
sergeyb at tarantool.org
Wed Jan 13 11:48:34 MSK 2021
From: Sergey Bronnikov <sergeyb at tarantool.org>
TL;DR httpd.py warns that port is busy when restart server. With socket
option SO_REUSEADDR it allows to restart httpd.py without problem.
Socket option SO_REUSEADDR tells the kernel that even if this port is
busy, go ahead and reuse it anyway. If it is busy, but with another
state, you will still get an address already in use error. It is useful
if your server has been shut down, and then restarted right away while
sockets are still active on its port.
---
test/app-tap/httpd.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/app-tap/httpd.py b/test/app-tap/httpd.py
index 62435e91a..60084bdbf 100755
--- a/test/app-tap/httpd.py
+++ b/test/app-tap/httpd.py
@@ -138,6 +138,7 @@ else:
usage()
sock = socket.socket(sock_family, socket.SOCK_STREAM)
+sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(sock_addr)
sock.listen(10)
--
2.25.1
More information about the Tarantool-patches
mailing list