diff --git a/copyparty/broker_mpw.py b/copyparty/broker_mpw.py index 522cf10b..b69b579f 100644 --- a/copyparty/broker_mpw.py +++ b/copyparty/broker_mpw.py @@ -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: diff --git a/copyparty/broker_thr.py b/copyparty/broker_thr.py index 250069b9..b6528929 100644 --- a/copyparty/broker_thr.py +++ b/copyparty/broker_thr.py @@ -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: diff --git a/copyparty/httpconn.py b/copyparty/httpconn.py index 449135af..27ab28a7 100644 --- a/copyparty/httpconn.py +++ b/copyparty/httpconn.py @@ -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 diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index 7d1b976d..667e4b95 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -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] diff --git a/copyparty/tcpsrv.py b/copyparty/tcpsrv.py index 94e6d73b..69198242 100644 --- a/copyparty/tcpsrv.py +++ b/copyparty/tcpsrv.py @@ -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)