]> git.lizzy.rs Git - rust.git/commitdiff
Add timeout to use of `curl` in bootstrap.py.
authorkennytm <kennytm@gmail.com>
Mon, 30 Jul 2018 04:06:22 +0000 (12:06 +0800)
committerkennytm <kennytm@gmail.com>
Mon, 30 Jul 2018 04:06:22 +0000 (12:06 +0800)
src/bootstrap/bootstrap.py

index 71c1c61e3d97ebd51e9bd8cf5b9946cbcbe5ca5c..829487163a945ec21f9850c997901520105ec9b4 100644 (file)
@@ -88,7 +88,10 @@ def _download(path, url, probably_big, verbose, exception):
             option = "-#"
         else:
             option = "-s"
-        run(["curl", option, "--retry", "3", "-Sf", "-o", path, url],
+        run(["curl", option,
+             "-y", "30", "-Y", "10",    # timeout if speed is < 10 bytes/sec for > 30 seconds
+             "--connect-timeout", "30", # timeout if cannot connect within 30 seconds
+             "--retry", "3", "-Sf", "-o", path, url],
             verbose=verbose,
             exception=exception)