Commit 98068a40 authored by Jim Fulton's avatar Jim Fulton

Fixed a unix file descriptor leak.

parent de952a80
...@@ -137,13 +137,15 @@ if os.name == 'posix': ...@@ -137,13 +137,15 @@ if os.name == 'posix':
def __init__(self, map=None): def __init__(self, map=None):
_triggerbase.__init__(self) _triggerbase.__init__(self)
r, self.trigger = self._fds = os.pipe() r, self.trigger = os.pipe()
asyncore.file_dispatcher.__init__(self, r, map) asyncore.file_dispatcher.__init__(self, r, map)
# file_dispatcher dups r, so we don't need it any more
os.close(r)
def _close(self): def _close(self):
for fd in self._fds: os.close(self.trigger)
os.close(fd) asyncore.file_dispatcher.close(self)
self._fds = []
def _physical_pull(self): def _physical_pull(self):
os.write(self.trigger, 'x') os.write(self.trigger, 'x')
......
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