From add04478e585344f85a04eb81e1ba6691d91a292 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 15 Sep 2022 22:25:11 +0200 Subject: [PATCH] multiprocessing: fix listening-socket config --- copyparty/httpconn.py | 6 +----- copyparty/httpsrv.py | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/copyparty/httpconn.py b/copyparty/httpconn.py index 298cbc56..b1e029fb 100644 --- a/copyparty/httpconn.py +++ b/copyparty/httpconn.py @@ -191,11 +191,7 @@ class HttpConn(object): except Exception as ex: em = str(ex) - if "ALERT_BAD_CERTIFICATE" in em: - # firefox-linux if there is no exception yet - self.log("client rejected our certificate (nice)") - - elif "ALERT_CERTIFICATE_UNKNOWN" in em: + if "ALERT_CERTIFICATE_UNKNOWN" in em: # android-chrome keeps doing this pass diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index 9400eadf..fe46eb6c 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -155,6 +155,12 @@ class HttpSrv(object): return def listen(self, sck: socket.socket, nlisteners: int) -> None: + if self.args.j != 1: + # lost in the pickle; redefine + sck.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sck.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + sck.settimeout(None) # < does not inherit, ^ does + ip, port = sck.getsockname() self.srvs.append(sck) self.nclimax = math.ceil(self.args.nc * 1.0 / nlisteners)