]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: improve Windows SO_SNDBUF update limit
authorJay Satiro <raysatiro@yahoo.com>
Fri, 9 Feb 2024 09:08:35 +0000 (04:08 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 13 Feb 2024 08:46:17 +0000 (03:46 -0500)
- Change the 1 second SO_SNDBUF update limit from per transfer to per
  connection.

Prior to this change many transfers over the same connection could cause
many SO_SNDBUF updates made to that connection per second, which was
unnecessary.

Closes https://github.com/curl/curl/pull/12911

lib/transfer.c
lib/urldata.h

index 7d9fa6bd4f791b4dccbc3c0c665f5a70db813466..63a16ae86ddb0511be53532e309593647cc7b2ae 100644 (file)
@@ -781,9 +781,9 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
 #if defined(_WIN32) && defined(USE_WINSOCK)
     {
       struct curltime n = Curl_now();
-      if(Curl_timediff(n, k->last_sndbuf_update) > 1000) {
+      if(Curl_timediff(n, conn->last_sndbuf_update) > 1000) {
         win_update_buffer_size(conn->writesockfd);
-        k->last_sndbuf_update = n;
+        conn->last_sndbuf_update = n;
       }
     }
 #endif
index fabc30ea4b1d9493ebdcbddd46ceb414f9dabd9b..21bc61348c9d9f3962379b9a8d82729f6da67897 100644 (file)
@@ -721,10 +721,6 @@ struct SingleRequest {
   } p;
 #ifndef CURL_DISABLE_DOH
   struct dohdata *doh; /* DoH specific data for this request */
-#endif
-#if defined(_WIN32) && defined(USE_WINSOCK)
-  struct curltime last_sndbuf_update;  /* last time readwrite_upload called
-                                          win_update_buffer_size */
 #endif
   char fread_eof[2]; /* the body read callback (index 0) returned EOF or
                         the trailer read callback (index 1) returned EOF */
@@ -998,6 +994,11 @@ struct connectdata {
   CtxtHandle *sslContext;
 #endif
 
+#if defined(_WIN32) && defined(USE_WINSOCK)
+  struct curltime last_sndbuf_update;  /* last time readwrite_upload called
+                                          win_update_buffer_size */
+#endif
+
 #ifdef USE_GSASL
   struct gsasldata gsasl;
 #endif