diff options
| author | teor (Tim Wilson-Brown) <teor2345@gmail.com> | 2015-10-09 06:25:01 +1100 |
|---|---|---|
| committer | teor (Tim Wilson-Brown) <teor2345@gmail.com> | 2015-10-09 06:25:01 +1100 |
| commit | 42e7bd4c53e3a84ddae3d5900017753b32e998df (patch) | |
| tree | 149da47123c00ab2ff7c173383b7ef2a4df0e67d | |
| parent | df6ad20619893ca974d5515cf94f4c67e7a7cd08 (diff) | |
fixup #15353 - Sleep when transmitting bytes temporarily fails
When we fail to send bytes, sleep for 1 second before retrying.
This avoids trying a few thousand times a second.
| -rw-r--r-- | lib/chutney/Traffic.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py index 76f16e4..7d61759 100644 --- a/lib/chutney/Traffic.py +++ b/lib/chutney/Traffic.py @@ -27,6 +27,7 @@ import socket import select import struct import errno +import time # Set debug_flag=True in order to debug this program or to get hints # about what's going wrong in your system. @@ -291,9 +292,10 @@ class Source(Peer): else: debug("BUG: sent no bytes") self._sent_no_bytes += 1 - if self._sent_no_bytes >= 10000: + if self._sent_no_bytes >= 10: print("Send no data %d times. Stalled." % (self._sent_no_bytes)) sys.exit(-1) + time.sleep(1) self.outbuf = self.outbuf[n:] if self.state == self.CONNECTING_THROUGH_PROXY: return 1 # Keep us around. |
