summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-01-02 18:04:58 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-01-10 10:07:11 +0100
commit152a81e45b62adc9086f895551a0d201be7e7e2f (patch)
tree2ca24f5f0252385b8414bd208227224b0cab1b0b /lib/url.c
parent4c35574bb785ce44d72db5483541c9da2d885705 (diff)
downloadcurl-152a81e45b62adc9086f895551a0d201be7e7e2f.tar.gz
urldata: rename easy_conn to just connbagder/conn-data-cleanup
We use "conn" everywhere to be a pointer to the connection. Introduces two functions that "attaches" and "detaches" the connection to and from the transfer. Going forward, we should favour using "data->conn" (since a transfer always only has a single connection or none at all) to "conn->data" (since a connection can have none, one or many transfers associated with it and updating conn->data to be correct is error prone and a frequent reason for internal issues). Side-effect: this also removes some old pipelining logic that isn't used and is destined for removal in April 2019 according to DEPRECATE.md. Closes #3442
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/url.c b/lib/url.c
index d6d5f8c5c..98bcdac36 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3607,6 +3607,7 @@ static CURLcode create_conn(struct Curl_easy *data,
size_t max_total_connections = Curl_multi_max_total_connections(data->multi);
*async = FALSE;
+ *in_connect = NULL;
/*************************************************************
* Check input data
@@ -4134,11 +4135,11 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
}
CURLcode Curl_connect(struct Curl_easy *data,
- struct connectdata **in_connect,
bool *asyncp,
bool *protocol_done)
{
CURLcode result;
+ struct connectdata *conn;
*asyncp = FALSE; /* assume synchronous resolves by default */
@@ -4148,30 +4149,30 @@ CURLcode Curl_connect(struct Curl_easy *data,
data->req.maxdownload = -1;
/* call the stuff that needs to be called */
- result = create_conn(data, in_connect, asyncp);
+ result = create_conn(data, &conn, asyncp);
if(!result) {
- if(CONN_INUSE(*in_connect))
+ if(CONN_INUSE(conn))
/* pipelining */
*protocol_done = TRUE;
else if(!*asyncp) {
/* DNS resolution is done: that's either because this is a reused
connection, in which case DNS was unnecessary, or because DNS
really did finish already (synch resolver/fast async resolve) */
- result = Curl_setup_conn(*in_connect, protocol_done);
+ result = Curl_setup_conn(conn, protocol_done);
}
}
if(result == CURLE_NO_CONNECTION_AVAILABLE) {
- *in_connect = NULL;
return result;
}
- else if(result && *in_connect) {
+ else if(result && conn) {
/* We're not allowed to return failure with memory left allocated in the
connectdata struct, free those here */
- Curl_disconnect(data, *in_connect, TRUE);
- *in_connect = NULL; /* return a NULL */
+ Curl_disconnect(data, conn, TRUE);
}
+ else
+ Curl_attach_connnection(data, conn);
return result;
}