[Twisted-Python] internet/tcp.py problem

Manuel Estrada Sainz ranty-bulk at ranty.ddts.net
Sat Jul 6 19:03:36 MDT 2002


 Hello,

 I am in vacation, and should not be hacking on anything, but some how I
 keep having trouble with twisted :)

 tcp.Client calls self.failIfNotConnected in two ways, via
 reactor.callLater with a timeout and in resolveAddress when it can't
 resolve the address.

 The problem is, that when resolveAddress can't resolve the address, it
 calls self.failIfNotConnected and later when the timeout is reached and
 self.failIfNotConnected called again, the socket is still not
 connected, so my connectionFailed method gets called twice which I
 don't think is right.

 I see two fixes for this:

  - Keep the return value of callLater and cancel it on
    self.failIfNotConnected.
  - Use some flag variable so self.failIfNotConnected knows that it
    already called connectionFailed and it doesn't do it again on the
    timeout.

 Thanks

 	ranty
-- 
--- Manuel Estrada Sainz <ranty at debian.org>
                         <ranty at bigfoot.com>
			 <ranty at users.sourceforge.net>
------------------------ <manuel.estrada at hispalinux.es> -------------------
God grant us the serenity to accept the things we cannot change, courage to
change the things we can, and wisdom to know the difference.




More information about the Twisted-Python mailing list