[bitbake-devel] [PATCH 1/2] hashserv: Ensure we don't accumulate sockets in TIME_WAIT state
Richard Purdie
richard.purdie at linuxfoundation.org
Fri Aug 16 09:04:17 UTC 2019
This can cause a huge backlog of closing sockets on the server and
in our case we don't really want/need the protection TCP is trying to
give us so work around it.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/hashserv/__init__.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/hashserv/__init__.py b/lib/hashserv/__init__.py
index 55966e748a..eb03c32213 100644
--- a/lib/hashserv/__init__.py
+++ b/lib/hashserv/__init__.py
@@ -14,6 +14,8 @@ import socketserver
import queue
import threading
import signal
+import socket
+import struct
from datetime import datetime
logger = logging.getLogger('hashserv')
@@ -157,6 +159,10 @@ class ThreadedHTTPServer(HTTPServer):
self.server_close()
os._exit(0)
+ def server_bind(self):
+ HTTPServer.server_bind(self)
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))
+
def process_request_thread(self):
while not self.quit:
try:
--
2.20.1
More information about the bitbake-devel
mailing list