[tor-commits] [chutney/master] Return 1 from Source.on_readable() when connected over proxy.

nickm at torproject.org nickm at torproject.org
Mon Jun 24 17:08:21 UTC 2013


commit 2b948b5631ba6c5acfc381050520dc32dfac9a2e
Author: Linus Nordberg <linus at torproject.org>
Date:   Wed Jun 5 15:48:57 2013 +0200

    Return 1 from Source.on_readable() when connected over proxy.
    
    We used to return 8 by accident (8 minus length of emptied inbuf).
    This is more explicit.
---
 lib/chutney/Traffic.py |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py
index ab9a578..7202c3d 100644
--- a/lib/chutney/Traffic.py
+++ b/lib/chutney/Traffic.py
@@ -185,11 +185,13 @@ class Source(Peer):
                     self.inbuf = ''
                     self.outbuf = self.data
                     debug("successfully connected (fd=%d)" % self.fd())
+                    return 1    # Keep us around for writing.
                 else:
                     debug("proxy handshake failed (0x%x)! (fd=%d)" %
                           (ord(self.inbuf[1]), self.fd()))
                     self.state = self.NOT_CONNECTED
                     return -1
+            assert(8 - len(self.inbuf) > 0)
             return 8 - len(self.inbuf)
         return 1                # Keep us around for writing.
 





More information about the tor-commits mailing list