]> granicus.if.org Git - curl/commitdiff
- Made the SO_SNDBUF setting for the data connection socket for ftp uploads as
authorDaniel Stenberg <daniel@haxx.se>
Thu, 7 May 2009 20:00:44 +0000 (20:00 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 7 May 2009 20:00:44 +0000 (20:00 +0000)
  well. See change 28 Apr 2009.

CHANGES
lib/connect.c
lib/connect.h
lib/ftp.c

diff --git a/CHANGES b/CHANGES
index 4d7f683ef551220f551f4ffc87e47d20c72f0101..f1a644fd4d33ff25369702bdf7e2909076ef8b6e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel Stenberg (7 May 2009)
+- Made the SO_SNDBUF setting for the data connection socket for ftp uploads as
+  well. See change 28 Apr 2009.
+
 Yang Tse (7 May 2009)
 - Fixed an issue affecting FTP transfers, introduced with the transfer.c
   patch committed May 4.
index d7b2f7fc0a9782da0d1fe59c376c6d74e38fb883..930b2b039f4f296d0f941fdbc908e533b0aa5c71 100644 (file)
@@ -714,15 +714,13 @@ static void nosigpipe(struct connectdata *conn,
    Buffer Size
 
 */
-static void sndbufset(struct connectdata *conn,
-                      curl_socket_t sockfd)
+void Curl_sndbufset(curl_socket_t sockfd)
 {
   int val = CURL_MAX_WRITE_SIZE + 32;
-  (void)conn;
   setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
 }
 #else
-#define sndbufset(x,y)
+#define Curl_sndbufset(y)
 #endif
 
 
@@ -829,7 +827,7 @@ singleipconnect(struct connectdata *conn,
 
   nosigpipe(conn, sockfd);
 
-  sndbufset(conn, sockfd);
+  Curl_sndbufset(sockfd);
 
   if(data->set.fsockopt) {
     /* activate callback for setting socket options */
index 38ed4125b64771e355977f82331197ae3d6d4d98..ae47c21745400f97036b67f34cba0a5899335a72 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -54,4 +54,20 @@ long Curl_timeleft(struct connectdata *conn,
 CURLcode Curl_getconnectinfo(struct SessionHandle *data,
                              long *param_longp,
                              struct connectdata **connp);
+
+#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
+
+*/
+void Curl_sndbufset(curl_socket_t sockfd);
+#else
+#define Curl_sndbufset(y)
+#endif
+
 #endif
index e8f51c6857692b93a8ac2f595e55249e9d3441dc..e9931ae04b81fd2d958a3074a9125508037790c0 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2308,6 +2308,9 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
 
   Curl_pgrsSetUploadSize(data, data->set.infilesize);
 
+  /* set the SO_SNDBUF for the secondary socket for those who need it */
+  Curl_sndbufset(conn->sock[SECONDARYSOCKET]);
+
   result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */
                                SECONDARYSOCKET, ftp->bytecountp);
   state(conn, FTP_STOP);