Created
January 4, 2020 12:55
-
-
Save kunalekawde/5cdfe5164b85d42c2b5ab5cdc9f70944 to your computer and use it in GitHub Desktop.
connection_reuse patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -urNp curl-7.67.0/lib/url.c curl-7.67.0/lib/url.c | |
--- curl-7.67.0/lib/url.c 2020-01-02 03:46:39.358670000 -0500 | |
+++ curl-7.67.0/lib/url.c 2020-01-03 01:25:53.847411000 -0500 | |
@@ -1072,6 +1072,8 @@ ConnectionExists(struct Curl_easy *data, | |
while(curr) { | |
bool match = FALSE; | |
size_t multiplexed; | |
+ size_t multiplexed_cnt; | |
+ multiplexed_cnt = CONN_INUSE(check); | |
/* | |
* Note that if we use a HTTP proxy in normal mode (no tunneling), we | |
@@ -1345,9 +1347,9 @@ ConnectionExists(struct Curl_easy *data, | |
if(check->bits.multiplex) { | |
/* Multiplexed connections can only be HTTP/2 for now */ | |
struct http_conn *httpc = &check->proto.httpc; | |
- if(multiplexed >= httpc->settings.max_concurrent_streams) { | |
+ if(multiplexed_cnt >= httpc->settings.max_concurrent_streams) { | |
infof(data, "MAX_CONCURRENT_STREAMS reached, skip (%zu)\n", | |
- multiplexed); | |
+ multiplexed_cnt); | |
continue; | |
} | |
} | |
@@ -3593,25 +3595,6 @@ static CURLcode create_conn(struct Curl_ | |
else | |
reuse = ConnectionExists(data, conn, &conn_temp, &force_reuse, &waitpipe); | |
- /* If we found a reusable connection that is now marked as in use, we may | |
- still want to open a new connection if we are multiplexing. */ | |
- if(reuse && !force_reuse && IsMultiplexingPossible(data, conn_temp)) { | |
- size_t multiplexed = CONN_INUSE(conn_temp); | |
- if(multiplexed > 0) { | |
- infof(data, "Found connection %ld, with %zu requests on it\n", | |
- conn_temp->connection_id, multiplexed); | |
- | |
- if(Curl_conncache_bundle_size(conn_temp) < max_host_connections && | |
- Curl_conncache_size(data) < max_total_connections) { | |
- /* We want a new connection anyway */ | |
- reuse = FALSE; | |
- | |
- infof(data, "We can reuse, but we want a new connection anyway\n"); | |
- Curl_conncache_return_conn(conn_temp); | |
- } | |
- } | |
- } | |
- | |
if(reuse) { | |
/* | |
* We already have a connection for this, we got the former connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment