aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-04-28 20:27:06 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-04-28 20:27:06 +0000
commitd068001102519c01970808e1ec572016ee3d3408 (patch)
tree2619ca36d7c9a44447e816249a5259738c6b6c2f /lib/connect.c
parentd576be58dc2e87152188be34cf40a7b7578fc5a4 (diff)
- Constantine Sapuntzakis filed bug report #2783090
(http://curl.haxx.se/bug/view.cgi?id=2783090) pointing out that on windows we need to grow the SO_SNDBUF buffer somewhat to get really good upload speeds. http://support.microsoft.com/kb/823764 has the details. Friends confirmed that simply adding 32 to CURL_MAX_WRITE_SIZE is enough.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index c1206cee5..7727bf017 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -704,6 +704,27 @@ static void nosigpipe(struct connectdata *conn,
#define nosigpipe(x,y)
#endif
+#ifdef WIN32
+/* When you run a program that uses the Windows Sockets API, you may
+ experience slow performance when you copy data to a TCP server.
+
+ http://support.microsoft.com/kb/823764
+
+ Work-around: Make the Socket Send Buffer Size Larger Than the Program Send
+ Buffer Size
+
+*/
+static void sndbufset(struct connectdata *conn,
+ curl_socket_t sockfd)
+{
+ int val = CURL_MAX_WRITE_SIZE + 32;
+ setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
+}
+#else
+#define sndbufset(x,y)
+#endif
+
+
/* singleipconnect() connects to the given IP only, and it may return without
having connected if used from the multi interface. */
static curl_socket_t
@@ -807,6 +828,8 @@ singleipconnect(struct connectdata *conn,
nosigpipe(conn, sockfd);
+ sndbufset(conn, sockfd);
+
if(data->set.fsockopt) {
/* activate callback for setting socket options */
error = data->set.fsockopt(data->set.sockopt_client,