aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-06-27 10:46:12 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-06-27 10:46:12 +1200
commit6b6317e1de7d4168debe9fc3aa5427aab40f13fd (patch)
tree640dc795b49ca7015c5701d836b6f6c03ce9389f
parente3c869e4c9ef740c0d80d83adb605094e819b23f (diff)
downloadmitmproxy-6b6317e1de7d4168debe9fc3aa5427aab40f13fd.tar.gz
mitmproxy-6b6317e1de7d4168debe9fc3aa5427aab40f13fd.tar.bz2
mitmproxy-6b6317e1de7d4168debe9fc3aa5427aab40f13fd.zip
Properly handle pause forever
Fixes #21
-rw-r--r--libpathod/language/writer.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/libpathod/language/writer.py b/libpathod/language/writer.py
index 3bacbf87..5e211977 100644
--- a/libpathod/language/writer.py
+++ b/libpathod/language/writer.py
@@ -2,6 +2,9 @@ import time
import netlib.tcp
BLOCKSIZE = 1024
+# It's not clear what the upper limit for time.sleep is. It's lower than the
+# maximum int or float. 1 year should do.
+FOREVER = 60 * 60 * 24 * 365
def send_chunk(fp, val, blocksize, start, end):
@@ -41,7 +44,9 @@ def write_values(fp, vals, actions, sofar=0, blocksize=BLOCKSIZE):
a[0] - sofar - offset
)
if a[1] == "pause":
- time.sleep(a[2])
+ time.sleep(
+ FOREVER if a[2] == "f" else a[2]
+ )
elif a[1] == "disconnect":
return True
elif a[1] == "inject":