multiprocessing: fix listening-socket config

This commit is contained in:
ed 2022-09-15 22:25:11 +02:00
parent 6db72d7166
commit add04478e5
2 changed files with 7 additions and 5 deletions

View file

@ -191,11 +191,7 @@ class HttpConn(object):
except Exception as ex: except Exception as ex:
em = str(ex) em = str(ex)
if "ALERT_BAD_CERTIFICATE" in em: if "ALERT_CERTIFICATE_UNKNOWN" in em:
# firefox-linux if there is no exception yet
self.log("client rejected our certificate (nice)")
elif "ALERT_CERTIFICATE_UNKNOWN" in em:
# android-chrome keeps doing this # android-chrome keeps doing this
pass pass

View file

@ -155,6 +155,12 @@ class HttpSrv(object):
return return
def listen(self, sck: socket.socket, nlisteners: int) -> None: 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() ip, port = sck.getsockname()
self.srvs.append(sck) self.srvs.append(sck)
self.nclimax = math.ceil(self.args.nc * 1.0 / nlisteners) self.nclimax = math.ceil(self.args.nc * 1.0 / nlisteners)