[Zope3-checkins] SVN: Zope3/trunk/src/zope/server/ftp/server.py When accept() returns None, ignore the result.

Shane Hathaway shane at zope.com
Tue Sep 14 22:32:04 EDT 2004


Log message for revision 27535:
  When accept() returns None, ignore the result.
  
  It's a strange workaround, but it seems to work for the case where 
  the OS says a client connection is ready but it actually turns out that 
  none is there.  Perhaps this happens if the client disconnects quickly.
  


Changed:
  U   Zope3/trunk/src/zope/server/ftp/server.py


-=-
Modified: Zope3/trunk/src/zope/server/ftp/server.py
===================================================================
--- Zope3/trunk/src/zope/server/ftp/server.py	2004-09-14 22:30:04 UTC (rev 27534)
+++ Zope3/trunk/src/zope/server/ftp/server.py	2004-09-15 02:32:02 UTC (rev 27535)
@@ -710,7 +710,17 @@
             self.accepted.close()
 
     def handle_accept (self):
-        self.accepted, addr = self.accept()
+        """Accept a connection from the client.
+
+        For some reason, sometimes accept() returns None instead of a
+        socket.  This code ignores that case.
+        """
+        v = self.accept()
+        if v is None:
+            return
+        self.accepted, addr = v
+        if self.accepted is None:
+            return
         self.accepted.setblocking(0)
         self.closed = True
         self.close()



More information about the Zope3-Checkins mailing list