diff --git a/src/connect.c b/src/connect.c index f12225d8..8b8620da 100644 --- a/src/connect.c +++ b/src/connect.c @@ -179,7 +179,8 @@ connect_to_one (ip_address *addr, unsigned short port, int silent) #ifdef SO_RCVBUF /* For very small rate limits, set the buffer size (and hence, hopefully, the size of the kernel window) to the size of the - limit. */ + limit. That way we don't sleep for more than 1s between network + reads. */ if (opt.limit_rate && opt.limit_rate < 8192) { int bufsize = opt.limit_rate; diff --git a/src/retr.c b/src/retr.c index 1af9a1b8..3d8357fc 100644 --- a/src/retr.c +++ b/src/retr.c @@ -194,8 +194,10 @@ get_contents (int fd, FILE *fp, long *len, long restval, long expected, limit_bandwidth_reset (); wtimer_reset (timer); - /* If we're limiting the download, set our buffer size to the - limit. */ + /* Use a smaller buffer for low requested bandwidths. For example, + with --limit-rate=2k, it doesn't make sense to slurp in 16K of + data and then sleep for 8s. With buffer size equal to the limit, + we never have to sleep for more than one second. */ if (opt.limit_rate && opt.limit_rate < dlbufsize) dlbufsize = opt.limit_rate;