Commit 43fdd059 authored by Julien Muchembled's avatar Julien Muchembled

Fix potential EMFILE when retrying to connect indefinitely

parent 6f86c773
...@@ -131,10 +131,15 @@ class EpollEventManager(object): ...@@ -131,10 +131,15 @@ class EpollEventManager(object):
else: else:
self.reader_set.discard(fd) self.reader_set.discard(fd)
self.writer_set.discard(fd) self.writer_set.discard(fd)
if close:
self._closeAppend(connector.shutdown())
if self._closeAcquire(0):
self._closeRelease()
return
if close: if close:
self._closeAppend(connector.shutdown()) # The connection is not registered, so do not wait for epoll
if self._closeAcquire(0): # to wake up (which may not even happen, and lead to EMFILE).
self._closeRelease() connector.shutdown()()
def isIdle(self): def isIdle(self):
return not (self._pending_processing or self.writer_set) return not (self._pending_processing or self.writer_set)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment