[Twisted-Python] Another tcp.Client question

Glyph Lefkowitz glyph at twistedmatrix.com
Sat Sep 1 20:00:19 MDT 2001


I just looked at it and I think that this patch (which I'm about to commit,
after doing some testing) should solve the problem:

diff -u -r1.16 tcp.py
--- twisted/internet/tcp.py     2001/08/29 10:13:55     1.16
+++ twisted/internet/tcp.py     2001/09/02 01:58:55
@@ -159,10 +159,10 @@
             self.socket.connect(self.addr)
         except socket.error, se:
             if se.args[0] in (EWOULDBLOCK, EALREADY, EINPROGRESS):
-                pass
+                self.startWriting()
             else:
                 self.protocol.connectionFailed()
-                return CONNECTION_LOST
+                self.stopWriting()
         # If I have reached this point without raising or returning, that means
         # that the socket is connected.
         del self.doWrite
@@ -332,7 +332,7 @@
         # Since ports can't, by definition, write any data, we can just close
         # instantly (no need for the more complex stuff for selectables which
         # write)
-        removeReader(self)
+        self.stopReading()
         self.connectionLost()
 
     def connectionLost(self):


On Fri, Aug 31, 2001 at 02:46:01PM -0400, Itamar wrote:
> One problem with my patch - both connectionFailed and connectionLost are 
> called on the protocol, instead of just connectionFailed.
> 
> 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

-- 
                      ______      __   __  _____  _     _
                     |  ____ |      \_/   |_____] |_____|
                     |_____| |_____  |    |       |     |
                     @ t w i s t e d m a t r i x  . c o m
                     http://twistedmatrix.com/users/glyph





More information about the Twisted-Python mailing list