commit df6ad20619893ca974d5515cf94f4c67e7a7cd08 Author: teor (Tim Wilson-Brown) teor2345@gmail.com Date: Tue Oct 6 16:17:09 2015 +1100
If chutney repeatedly sends no bytes, stop trying
This only seems to happen when all external network interfaces are down. But Tor should still work using 127.0.0.1.
This requires further investigation.
Investigatory changes for #15353. --- lib/chutney/Traffic.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py index 3796205..76f16e4 100644 --- a/lib/chutney/Traffic.py +++ b/lib/chutney/Traffic.py @@ -200,6 +200,7 @@ class Source(Peer): self.inbuf = '' self.proxy = proxy self.repetitions = repetitions + self._sent_no_bytes = 0 # sanity checks if len(self.data) == 0: self.repetitions = 0 @@ -283,8 +284,16 @@ class Source(Peer): raise # sometimes, this debug statement prints 0 # it should print length of the data sent - # but the code works regardless of this error - debug("successfully sent (bytes=%d)" % n) + # but the code works as long as this doesn't keep on happening + if n > 0: + debug("successfully sent (bytes=%d)" % n) + self._sent_no_bytes = 0 + else: + debug("BUG: sent no bytes") + self._sent_no_bytes += 1 + if self._sent_no_bytes >= 10000: + print("Send no data %d times. Stalled." % (self._sent_no_bytes)) + sys.exit(-1) self.outbuf = self.outbuf[n:] if self.state == self.CONNECTING_THROUGH_PROXY: return 1 # Keep us around.