Skip to content

Commit

Permalink
transfer: improve Windows SO_SNDBUF update limit
Browse files Browse the repository at this point in the history
- 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 curl#12911
  • Loading branch information
jay committed Feb 13, 2024
1 parent 24d6c28 commit 5691a6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/urldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5691a6c

Please sign in to comment.