parallel socket shutdown

This commit is contained in:
ed 2022-08-31 08:38:34 +02:00
parent 558bfa4e1e
commit bc6234e032

View file

@ -278,12 +278,12 @@ class HttpSrv(object):
except:
pass
thrs = []
clients = list(self.clients)
for cli in clients:
try:
cli.shutdown()
except:
pass
t = threading.Thread(target=cli.shutdown)
thrs.append(t)
t.start()
if self.tp_q:
self.stop_threads(self.tp_nthr)
@ -292,6 +292,9 @@ class HttpSrv(object):
if self.tp_q.empty():
break
for t in thrs:
t.join()
self.log(self.name, "ok bye")
def thr_client(self, sck: socket.socket, addr: tuple[str, int]) -> None: