From 5ed274d0b7483085d5d8642daddace93b41316e7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 1 Oct 2009 07:05:07 +0000 Subject: - Constantine Sapuntzakis: The current implementation will always set SO_SNDBUF to CURL_WRITE_SIZE even if the SO_SNDBUF starts out larger. The patch doesn't do a setsockopt if SO_SNDBUF is already greater than CURL_WRITE_SIZE. This should help folks who have set up their computer with large send buffers. --- lib/connect.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/connect.c b/lib/connect.c index 2a6b003e0..aaeee6762 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -664,6 +664,13 @@ static void nosigpipe(struct connectdata *conn, void Curl_sndbufset(curl_socket_t sockfd) { int val = CURL_MAX_WRITE_SIZE + 32; + int curval = 0; + int curlen = sizeof(curval); + + if (getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&curval, &curlen) == 0) + if (curval > val) + return; + setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val)); } #endif -- cgit v1.2.3