finally time to undefault this

This commit is contained in:
ed
2021-03-21 16:19:45 +01:00
parent 8dbbea473f
commit 49e4fb7e12
5 changed files with 31 additions and 14 deletions

View File

@@ -38,7 +38,9 @@ class HttpSrv(object):
def accept(self, sck, addr):
"""takes an incoming tcp connection and creates a thread to handle it"""
self.log("%s %s" % addr, "|%sC-cthr" % ("-" * 5,), c="1;30")
if self.args.log_conn:
self.log("%s %s" % addr, "|%sC-cthr" % ("-" * 5,), c="1;30")
thr = threading.Thread(target=self.thr_client, args=(sck, addr))
thr.daemon = True
thr.start()
@@ -66,11 +68,15 @@ class HttpSrv(object):
thr.start()
try:
self.log("%s %s" % addr, "|%sC-crun" % ("-" * 6,), c="1;30")
if self.args.log_conn:
self.log("%s %s" % addr, "|%sC-crun" % ("-" * 6,), c="1;30")
cli.run()
finally:
self.log("%s %s" % addr, "|%sC-cdone" % ("-" * 7,), c="1;30")
if self.args.log_conn:
self.log("%s %s" % addr, "|%sC-cdone" % ("-" * 7,), c="1;30")
try:
sck.shutdown(socket.SHUT_RDWR)
sck.close()