[Zope3-checkins] CVS: Zope3/lib/python/Zope/Server/FTP/tests - testFTPServer.py:1.4
Steve Alexander
steve@cat-box.net
Wed, 23 Oct 2002 11:29:40 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Server/FTP/tests
In directory cvs.zope.org:/tmp/cvs-serv5643
Modified Files:
testFTPServer.py
Log Message:
changed loop() to accommodate a race condition in asyncore.poll.
Without this change, the test could sometimes hang indefinitely.
=== Zope3/lib/python/Zope/Server/FTP/tests/testFTPServer.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/Server/FTP/tests/testFTPServer.py:1.3 Thu Oct 17 09:31:58 2002
+++ Zope3/lib/python/Zope/Server/FTP/tests/testFTPServer.py Wed Oct 23 11:29:39 2002
@@ -101,11 +101,18 @@
shutil.rmtree(self.root_dir)
def loop(self):
+ import select
+ from errno import EBADF
while self.run_loop:
self.counter = self.counter + 1
# print 'loop', self.counter
- poll(0.1, socket_map)
-
+ try:
+ poll(0.1, socket_map)
+ except select.error, data:
+ if data[0] == EBADF:
+ print "exception polling in loop(): ", data
+ else:
+ raise
def getFTPConnection(self, login=1):
ftp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)