if (sock < 0)
goto out;
-#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. That way we don't sleep for more than 1s between network
int bufsize = opt.limit_rate;
if (bufsize < 512)
bufsize = 512;
+#ifdef SO_RCVBUF
setsockopt (sock, SOL_SOCKET, SO_RCVBUF,
(char *)&bufsize, sizeof (bufsize));
- }
#endif
+ /* When we add opt.limit_rate support for writing, as with
+ `--post-file', also set SO_SNDBUF here. */
+ }
resolve_bind_address ();
if (bind_address_resolved)