Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transfer: limit Windows SO_SNDBUF updates to once a second #10611

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/transfer.c
Expand Up @@ -980,7 +980,15 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
if(result)
return result;

win_update_buffer_size(conn->writesockfd);
#if defined(WIN32) && defined(USE_WINSOCK)
{
struct curltime n = Curl_now();
if(Curl_timediff(n, k->last_sndbuf_update) > 1000) {
win_update_buffer_size(conn->writesockfd);
k->last_sndbuf_update = n;
}
}
#endif

if(k->pendingheader) {
/* parts of what was sent was header */
Expand Down
4 changes: 4 additions & 0 deletions lib/urldata.h
Expand Up @@ -689,6 +689,10 @@ struct SingleRequest {
#endif
unsigned char setcookies;
unsigned char writer_stack_depth; /* Unencoding stack depth. */
#if defined(WIN32) && defined(USE_WINSOCK)
struct curltime last_sndbuf_update; /* last time readwrite_upload called
win_update_buffer_size */
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try putting entries in (roughly) size order in the struct to allow better packing optimization. Ie you could add this new struct above the two unsigned char entries.

BIT(header); /* incoming data has HTTP header */
BIT(content_range); /* set TRUE if Content-Range: was found */
BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
Expand Down