commit f993a27167655b4d565987d54acf3aa6a9b39221 Author: David Fifield david@bamsoftware.com Date: Thu Nov 3 20:29:15 2011 -0700
Keep retrying remote-tor downloads.
Sometimes a proxy going down at just the right moment can cause Tor to reject a SOCKS connection (with code 91). This seems to confuse Wget's automatic retrying; it starts over from the beginning. I have also seen it abort the Wget download completely. So download the file to an actual file rather than /dev/null, and run Wget with -c in a loop. --- experiments/switching/remote-tor-alternating.sh | 12 ++++++++++-- experiments/switching/remote-tor-constant.sh | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/experiments/switching/remote-tor-alternating.sh b/experiments/switching/remote-tor-alternating.sh index 97fb749..a9c394d 100755 --- a/experiments/switching/remote-tor-alternating.sh +++ b/experiments/switching/remote-tor-alternating.sh @@ -22,6 +22,8 @@ stop() { echo "Kill pids ${PIDS_TO_KILL[@]}." kill "${PIDS_TO_KILL[@]}" fi + echo "Delete data file." + rm -f "$DATA_FILE_NAME" exit } trap stop EXIT @@ -54,8 +56,14 @@ PIDS_TO_KILL+=($!) # Let Tor bootstrap. visible_sleep 15
+repeat_download() { + until torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -c -t 0 -O "$DATA_FILE_NAME"; do + echo "retrying" + done +} + if [ -n "$OUTPUT_FILENAME" ]; then - real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -t 0 -O /dev/null >> "$OUTPUT_FILENAME" + real_time repeat_download >> "$OUTPUT_FILENAME" else - real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -t 0 -O /dev/null + real_time repeat_download fi diff --git a/experiments/switching/remote-tor-constant.sh b/experiments/switching/remote-tor-constant.sh index e4dc48c..c1cce88 100755 --- a/experiments/switching/remote-tor-constant.sh +++ b/experiments/switching/remote-tor-constant.sh @@ -21,6 +21,8 @@ stop() { echo "Kill pids ${PIDS_TO_KILL[@]}." kill "${PIDS_TO_KILL[@]}" fi + echo "Delete data file." + rm -f "$DATA_FILE_NAME" exit } trap stop EXIT @@ -50,7 +52,7 @@ browser_goto "$PROFILE_1" "$PROXY_URL" visible_sleep 15
if [ -n "$OUTPUT_FILENAME" ]; then - real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -t 0 -O /dev/null >> "$OUTPUT_FILENAME" + real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -c -t 0 -O "$DATA_FILE_NAME" >> "$OUTPUT_FILENAME" else - real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -t 0 -O /dev/null + real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -c -t 0 -O "$DATA_FILE_NAME" fi
tor-commits@lists.torproject.org