X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fretr.c;h=493b830f9f8c8e2dab30259dd6f8dd7757b7aa29;hb=91479b4c8ee7046e07e12848182fc635754c7a66;hp=c5c1532ba7188c7c39ef0dd6315e3fdf984a76e9;hpb=c035e39b7d16c1cc121e3967d73e93437941ad54;p=wget diff --git a/src/retr.c b/src/retr.c index c5c1532b..493b830f 100644 --- a/src/retr.c +++ b/src/retr.c @@ -82,6 +82,7 @@ limit_bandwidth_reset (void) { limit_data.chunk_bytes = 0; limit_data.chunk_start = 0; + limit_data.sleep_adjust = 0; } /* Limit the bandwidth by pausing the download for an amount of time. @@ -125,6 +126,12 @@ limit_bandwidth (wgint bytes, struct ptimer *timer) desired and the actual sleep, and adjust the next sleep by that amount. */ limit_data.sleep_adjust = slp - (t1 - t0); + /* If sleep_adjust is very large, it's likely due to suspension + and not clock inaccuracy. Don't enforce those. */ + if (limit_data.sleep_adjust > 500) + limit_data.sleep_adjust = 500; + else if (limit_data.sleep_adjust < -500) + limit_data.sleep_adjust = -500; } limit_data.chunk_bytes = 0;