mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
very temporary socket tracking dbg
This commit is contained in:
parent
9fcd4823b5
commit
9ef3945abf
|
@ -68,6 +68,7 @@ class MpWorker(object):
|
|||
if PY2:
|
||||
sck = pickle.loads(sck) # nosec
|
||||
|
||||
self.log(str(d[2]), "-" * 4 + "C-qpop")
|
||||
self.httpsrv.accept(sck, d[2])
|
||||
|
||||
with self.mutex:
|
||||
|
|
|
@ -27,6 +27,7 @@ class BrokerThr(object):
|
|||
def put(self, retq, act, *args):
|
||||
if act == "httpconn":
|
||||
sck, addr = args
|
||||
self.log(str(addr), "-" * 4 + "C-qpop")
|
||||
self.httpsrv.accept(sck, addr)
|
||||
|
||||
else:
|
||||
|
|
|
@ -59,11 +59,11 @@ class HttpConn(object):
|
|||
self.s = ssl.wrap_socket(
|
||||
self.s, server_side=True, certfile=self.cert_path
|
||||
)
|
||||
except OSError as ex:
|
||||
if "ALERT_BAD_CERTIFICATE" in ex.strerror:
|
||||
except Exception as ex:
|
||||
if "ALERT_BAD_CERTIFICATE" in str(ex):
|
||||
self.log("client rejected our certificate (nice)")
|
||||
else:
|
||||
raise
|
||||
self.log("\033[35mhandshake\033[0m " + str(ex))
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ class HttpSrv(object):
|
|||
|
||||
def accept(self, sck, addr):
|
||||
"""takes an incoming tcp connection and creates a thread to handle it"""
|
||||
self.log(str(addr), "-" * 5 + "C-cthr")
|
||||
thr = threading.Thread(target=self.thr_client, args=(sck, addr, self.log))
|
||||
thr.daemon = True
|
||||
thr.start()
|
||||
|
@ -62,9 +63,11 @@ class HttpSrv(object):
|
|||
thr.start()
|
||||
|
||||
try:
|
||||
self.log(str(addr), "-" * 6 + "C-crun")
|
||||
cli.run()
|
||||
|
||||
finally:
|
||||
self.log(str(addr), "-" * 7 + "C-done")
|
||||
sck.close()
|
||||
with self.mutex:
|
||||
del self.clients[cli]
|
||||
|
|
|
@ -59,11 +59,14 @@ class TcpSrv(object):
|
|||
self.log("tcpsrv", "listening @ {0}:{1}".format(self.args.i, self.args.p))
|
||||
|
||||
while True:
|
||||
self.log("tcpsrv", "-" * 1 + "C-ncli")
|
||||
if self.num_clients.v >= self.args.nc:
|
||||
time.sleep(0.1)
|
||||
continue
|
||||
|
||||
self.log("tcpsrv", "-" * 2 + "C-acc1")
|
||||
sck, addr = self.srv.accept()
|
||||
self.log(str(addr), "-" * 3 + "C-acc2")
|
||||
self.num_clients.add()
|
||||
self.hub.broker.put(None, "httpconn", sck, addr)
|
||||
|
||||
|
|
Loading…
Reference in a new issue