[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - forker.py:1.5.2.6

Jeremy Hylton jeremy@zope.com
Thu, 25 Oct 2001 20:36:31 -0400


Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv1258

Modified Files:
      Tag: zeo-1_0-branch
	forker.py 
Log Message:
Make sure the socket is closed in get_port().

XXX Close the other end of the pipe in the child.  Not sure if this
affects the parent.


=== StandaloneZODB/ZEO/tests/forker.py 1.5.2.5 => 1.5.2.6 ===
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         try:
-            s.connect(('localhost', port))
-        except socket.error:
-            # XXX check value of error?
-            return port
+            try:
+                s.connect(('localhost', port))
+            except socket.error:
+                # XXX check value of error?
+                return port
+        finally:
+            s.close()
     raise RuntimeError, "Can't find port"
 
 if os.name == "nt":
@@ -98,6 +101,7 @@
         ZEOServerExit(rd)
         serv = ZEO.StorageServer.StorageServer(addr, {'1':storage})
         asyncore.loop()
+        os.close(rd)
         storage.close()
         if isinstance(addr, types.StringType):
             os.unlink(addr)