[Twisted-Python] Another tcp.Client question

Itamar twisted at itamarst.org
Fri Aug 31 13:47:06 EDT 2001


Another question - shouldn't we return when getting a EWOULDBLOK or 
friends, since we haven't yet connected?

========================
class Client(Connection):
     #...

     def doConnect(self):
         """I connect the socket.

         Then, call the protocol's makeConnection, and start waiting for
         data.
         """
         try:
             self.socket.connect(self.addr)
         except socket.error, se:
             if se.args[0] in (EWOULDBLOCK, EALREADY, EINPROGRESS):
                 pass ###########  XXX shouldn't this be "return"? XXX
             else:
                 self.protocol.connectionFailed()
                 return CONNECTION_LOST
         # If I have reached this point without raising or returning,
         # that means that the socket is connected.






More information about the Twisted-Python mailing list