diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-01-18 11:56:50 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-01-19 09:14:51 +0100 |
commit | a304051620b92e12b6b1b4e19edc57b34ea332b6 (patch) | |
tree | 6611cb1f943e6eecebedd4fa19ec5d1716a38ccc /lib/url.c | |
parent | bbe3aa9f881fa27fe828e3c9a36d6831f254a3ee (diff) | |
download | curl-a304051620b92e12b6b1b4e19edc57b34ea332b6.tar.gz |
lib: more conn->data cleanups
Closes #6479
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -829,26 +829,23 @@ CURLcode Curl_disconnect(struct Curl_easy *data, /* Cleanup NEGOTIATE connection-related data */ Curl_http_auth_cleanup_negotiate(conn); - /* the protocol specific disconnect handler and conn_shutdown need a transfer - for the connection! */ - conn->data = data; - if(conn->bits.connect_only) /* treat the connection as dead in CONNECT_ONLY situations */ dead_connection = TRUE; - if(conn->handler->disconnect) { - /* During disconnect, the connection and the transfer is already - disassociated, but the SSH backends (and more?) still need the - transfer's connection pointer to identify the used connection */ - data->conn = conn; + /* temporarily attach the connection to this transfer handle for the + disonnect and shutdown */ + Curl_attach_connnection(data, conn); + if(conn->handler->disconnect) /* This is set if protocol-specific cleanups should be made */ conn->handler->disconnect(data, conn, dead_connection); - data->conn = NULL; /* forget it again */ - } conn_shutdown(data, conn); + + /* detach it again */ + Curl_detach_connnection(data); + conn_free(conn); return CURLE_OK; } @@ -1111,7 +1108,7 @@ ConnectionExists(struct Curl_easy *data, /* Look up the bundle with all the connections to this particular host. Locks the connection cache, beware of early returns! */ - bundle = Curl_conncache_find_bundle(needle, data->state.conn_cache, + bundle = Curl_conncache_find_bundle(data, needle, data->state.conn_cache, &hostbundle); if(bundle) { /* Max pipe length is zero (unlimited) for multiplexed connections */ @@ -3650,7 +3647,7 @@ static CURLcode create_conn(struct Curl_easy *data, conn->bits.tcpconnect[FIRSTSOCKET] = TRUE; /* we are "connected */ Curl_attach_connnection(data, conn); - result = Curl_conncache_add_conn(data->state.conn_cache, conn); + result = Curl_conncache_add_conn(data); if(result) goto out; @@ -3820,7 +3817,8 @@ static CURLcode create_conn(struct Curl_easy *data, /* this gets a lock on the conncache */ const char *bundlehost; struct connectbundle *bundle = - Curl_conncache_find_bundle(conn, data->state.conn_cache, &bundlehost); + Curl_conncache_find_bundle(data, conn, data->state.conn_cache, + &bundlehost); if(max_host_connections > 0 && bundle && (bundle->num_connections >= max_host_connections)) { @@ -3873,8 +3871,7 @@ static CURLcode create_conn(struct Curl_easy *data, * cache of ours! */ Curl_attach_connnection(data, conn); - - result = Curl_conncache_add_conn(data->state.conn_cache, conn); + result = Curl_conncache_add_conn(data); if(result) goto out; } |