Browse Source

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.
Linus Nordberg 11 years ago
parent
commit
2b948b5631
1 changed files with 2 additions and 0 deletions
  1. 2 0
      lib/chutney/Traffic.py

+ 2 - 0
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.