mirror of
https://github.com/curl/curl.git
synced 2026-08-01 21:20:28 +03:00
disconnect: separate connections and easy handles better
Do not assume/store assocation between a given easy handle and the connection if it can be avoided. Long-term, the 'conn->data' pointer should probably be removed as it is a little too error-prone. Still used very widely though. Reported-by: masbug on github Fixes #3391 Closes #3400
This commit is contained in:
parent
d18a5afaf0
commit
fb445a1e18
4 changed files with 13 additions and 13 deletions
|
|
@ -769,7 +769,6 @@ CURLcode Curl_disconnect(struct Curl_easy *data,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
conn->data = data;
|
||||
if(conn->dns_entry != NULL) {
|
||||
Curl_resolv_unlock(data, conn->dns_entry);
|
||||
conn->dns_entry = NULL;
|
||||
|
|
@ -788,14 +787,13 @@ CURLcode Curl_disconnect(struct Curl_easy *data,
|
|||
|
||||
/* unlink ourselves! */
|
||||
infof(data, "Closing connection %ld\n", conn->connection_id);
|
||||
Curl_conncache_remove_conn(conn, TRUE);
|
||||
Curl_conncache_remove_conn(data, conn, TRUE);
|
||||
|
||||
free_idnconverted_hostname(&conn->host);
|
||||
free_idnconverted_hostname(&conn->conn_to_host);
|
||||
free_idnconverted_hostname(&conn->http_proxy.host);
|
||||
free_idnconverted_hostname(&conn->socks_proxy.host);
|
||||
|
||||
DEBUGASSERT(conn->data == data);
|
||||
/* this assumes that the pointer is still there after the connection was
|
||||
detected from the cache */
|
||||
Curl_ssl_close(conn, FIRSTSOCKET);
|
||||
|
|
@ -960,8 +958,6 @@ static bool extract_if_dead(struct connectdata *conn,
|
|||
handles in pipeline and the connection isn't already marked in
|
||||
use */
|
||||
bool dead;
|
||||
|
||||
conn->data = data;
|
||||
if(conn->handler->connection_check) {
|
||||
/* The protocol has a special method for checking the state of the
|
||||
connection. Use it to check if the connection is dead. */
|
||||
|
|
@ -977,8 +973,7 @@ static bool extract_if_dead(struct connectdata *conn,
|
|||
|
||||
if(dead) {
|
||||
infof(data, "Connection %ld seems to be dead!\n", conn->connection_id);
|
||||
Curl_conncache_remove_conn(conn, FALSE);
|
||||
conn->data = NULL; /* detach */
|
||||
Curl_conncache_remove_conn(data, conn, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue