SVN: ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py Fixed file-descriptor leak, owing to fd duping.

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <[email protected]>
Log message for revision 104412:
  Fixed file-descriptor leak, owing to fd duping.
  

Changed:
  U   ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py

-=-
Modified: ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py
===================================================================
--- ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py	2009-09-21 20:58:29 UTC (rev 104411)
+++ ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py	2009-09-21 20:58:31 UTC (rev 104412)
@@ -137,13 +137,15 @@
 
         def __init__(self, map=None):
             _triggerbase.__init__(self)
-            r, self.trigger = self._fds = os.pipe()
+            r, self.trigger = os.pipe()
             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):
-            for fd in self._fds:
-                os.close(fd)
-            self._fds = []
+            os.close(self.trigger)
+            asyncore.file_dispatcher.close(self)
 
         def _physical_pull(self):
             os.write(self.trigger, 'x')
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.