summaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-02-15 10:15:46 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-02-16 10:48:57 +0100
commitcfff12a0b3d8696e5923064ea4e35e14a4f78da0 (patch)
tree40907a5b1d6bc3827e2cff454c72ce6c05d2fb4e /lib/multi.c
parenta59c33ceffb8f78b71fa084bbc99c94ecfe82ce6 (diff)
downloadcurl-cfff12a0b3d8696e5923064ea4e35e14a4f78da0.tar.gz
lib: remove 'conn->data' completely
The Curl_easy pointer struct entry in connectdata is now gone. Just before commit 215db086e0 landed on January 8, 2021 there were 919 references to conn->data. Closes #6608
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/lib/multi.c b/lib/multi.c
index bae8398bc..7bea2aba4 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -562,8 +562,6 @@ static CURLcode multi_done(struct Curl_easy *data,
/* Stop if multi_done() has already been called */
return CURLE_OK;
- conn->data = data; /* ensure the connection uses this transfer now */
-
/* Stop the resolver and free its own resources (but not dns_entry yet). */
Curl_resolver_kill(data);
@@ -604,16 +602,13 @@ static CURLcode multi_done(struct Curl_easy *data,
Curl_detach_connnection(data);
if(CONN_INUSE(conn)) {
/* Stop if still used. */
- /* conn->data must not remain pointing to this transfer since it is going
- away! Find another to own it! */
- conn->data = conn->easyq.head->ptr;
CONNCACHE_UNLOCK(data);
DEBUGF(infof(data, "Connection still in use %zu, "
"no more multi_done now!\n",
conn->easyq.size));
return CURLE_OK;
}
- conn->data = NULL; /* the connection now has no owner */
+
data->state.done = TRUE; /* called just now! */
if(conn->dns_entry) {
@@ -718,7 +713,6 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
{
struct Curl_easy *easy = data;
bool premature;
- bool easy_owns_conn;
struct Curl_llist_element *e;
/* First, make some basic checks that the CURLM handle is a good handle */
@@ -741,8 +735,6 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
return CURLM_RECURSIVE_API_CALL;
premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
- easy_owns_conn = (data->conn && (data->conn->data == easy)) ?
- TRUE : FALSE;
/* If the 'state' is not INIT or COMPLETED, we might need to do something
nice to put the easy_handle in a good known state when this returns. */
@@ -757,24 +749,16 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
data->mstate < CURLM_STATE_COMPLETED) {
/* Set connection owner so that the DONE function closes it. We can
safely do this here since connection is killed. */
- data->conn->data = easy;
streamclose(data->conn, "Removed with partial response");
- easy_owns_conn = TRUE;
}
if(data->conn) {
+ /* multi_done() clears the association between the easy handle and the
+ connection.
- /* we must call multi_done() here (if we still own the connection) so that
- we don't leave a half-baked one around */
- if(easy_owns_conn) {
-
- /* multi_done() clears the association between the easy handle and the
- connection.
-
- Note that this ignores the return code simply because there's
- nothing really useful to do with it anyway! */
- (void)multi_done(data, data->result, premature);
- }
+ Note that this ignores the return code simply because there's
+ nothing really useful to do with it anyway! */
+ (void)multi_done(data, data->result, premature);
}
/* The timer must be shut down before data->multi is set to NULL, else the
@@ -984,12 +968,6 @@ static int multi_getsock(struct Curl_easy *data,
if(!conn)
return 0;
- if(data->mstate > CURLM_STATE_CONNECT &&
- data->mstate < CURLM_STATE_COMPLETED) {
- /* Set up ownership correctly */
- data->conn->data = data;
- }
-
switch(data->mstate) {
default:
return 0;
@@ -1397,7 +1375,6 @@ static CURLcode multi_do(struct Curl_easy *data, bool *done)
DEBUGASSERT(conn);
DEBUGASSERT(conn->handler);
- DEBUGASSERT(conn->data == data);
if(conn->handler->do_it)
/* generic protocol-specific function pointer set in curl_connect() */
@@ -1584,7 +1561,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
DEBUGASSERT(data->conn);
if(!data->conn)
return CURLM_INTERNAL_ERROR;
- data->conn->data = data;
}
if(data->conn &&