mirror of
https://github.com/curl/curl.git
synced 2026-08-02 05:00:30 +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
|
|
@ -302,9 +302,14 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
|
|||
return result;
|
||||
}
|
||||
|
||||
void Curl_conncache_remove_conn(struct connectdata *conn, bool lock)
|
||||
/*
|
||||
* Removes the connectdata object from the connection cache *and* clears the
|
||||
* ->data pointer association. Pass TRUE/FALSE in the 'lock' argument
|
||||
* depending on if the parent function already holds the lock or not.
|
||||
*/
|
||||
void Curl_conncache_remove_conn(struct Curl_easy *data,
|
||||
struct connectdata *conn, bool lock)
|
||||
{
|
||||
struct Curl_easy *data = conn->data;
|
||||
struct connectbundle *bundle = conn->bundle;
|
||||
struct conncache *connc = data->state.conn_cache;
|
||||
|
||||
|
|
@ -323,6 +328,7 @@ void Curl_conncache_remove_conn(struct connectdata *conn, bool lock)
|
|||
DEBUGF(infof(data, "The cache now contains %zu members\n",
|
||||
connc->num_conn));
|
||||
}
|
||||
conn->data = NULL; /* clear the association */
|
||||
if(lock) {
|
||||
CONN_UNLOCK(data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue