[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [torflow/master 10/92] Slow xfer rate now results in a Timeout failure rather than NoExitContent
Author: John M. Schanck <john@xxxxxxxxxxx>
Date: Mon, 21 Jun 2010 01:33:58 -0400
Subject: Slow xfer rate now results in a Timeout failure rather than NoExitContent
Commit: 82da6692c8909a46ee925d3635ffbe9c2956c4f0
---
NetworkScanners/ExitAuthority/soat.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/NetworkScanners/ExitAuthority/soat.py b/NetworkScanners/ExitAuthority/soat.py
index 1ddc459..ed9eef1 100755
--- a/NetworkScanners/ExitAuthority/soat.py
+++ b/NetworkScanners/ExitAuthority/soat.py
@@ -2610,12 +2610,13 @@ def decompress_response_data(response):
# lack of progress.. or for a sign we should read..
len_read = len(data)
now = time.time()
-
+
plog("DEBUG", "Read "+str(len_read)+"/"+str(tot_len))
# Wait 5 seconds before counting data
- if (now-start) > 5 and len_read/(now-start) < min_rate:
+ rate = (float(len_read)/(now-start)) #B/s
+ if (now-start) > 5 and rate < min_rate:
plog("WARN", "Minimum xfer rate not maintained. Aborting xfer")
- return ""
+ raise socket.timeout("Rate: %.2f KB/s" % (rate/1024))
if not data_read:
break
--
1.7.1