issue #406: unix: don't leak already-closed socket object

if Side.close() closes the socket (which it does), and it gets reused,
GC will cause socketobject.__del__ to later delete some random FD.
issue260
David Wilson 6 years ago
parent dc3db49c5a
commit 411af6c167

@ -78,6 +78,11 @@ class Listener(mitogen.core.BasicStream):
self.receive_side = mitogen.core.Side(self, self._sock.fileno()) self.receive_side = mitogen.core.Side(self, self._sock.fileno())
router.broker.start_receive(self) router.broker.start_receive(self)
def on_shutdown(self, broker):
self._sock.close()
self.receive_side.closed = True
broker.stop_receive(self)
def _accept_client(self, sock): def _accept_client(self, sock):
sock.setblocking(True) sock.setblocking(True)
try: try:

Loading…
Cancel
Save