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