Skip to content

Commit

Permalink
urldata: rename easy_conn to just conn
Browse files Browse the repository at this point in the history
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).

Closes #3442
  • Loading branch information
bagder committed Jan 11, 2019
1 parent 61faa0b commit ba24323
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 204 deletions.
4 changes: 1 addition & 3 deletions lib/conncache.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2016, Linus Nielsen Feltzing, <linus@haxx.se>
* Copyright (C) 2012 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -572,8 +572,6 @@ void Curl_conncache_close_all_connections(struct conncache *connc)
conn->data = connc->closure_handle;

sigpipe_ignore(conn->data, &pipe_st);
conn->data->easy_conn = NULL; /* clear the easy handle's connection
pointer */
/* This will remove the connection from the cache */
connclose(conn, "kill all");
(void)Curl_disconnect(connc->closure_handle, conn, FALSE);
Expand Down
7 changes: 3 additions & 4 deletions lib/curl_sasl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -300,8 +300,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
result = Curl_auth_create_gssapi_user_message(data, conn->user,
conn->passwd,
service,
data->easy_conn->
host.name,
data->conn->host.name,
sasl->mutual_auth,
NULL, &conn->krb5,
&resp, &len);
Expand Down Expand Up @@ -517,7 +516,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
result = Curl_auth_create_gssapi_user_message(data, conn->user,
conn->passwd,
service,
data->easy_conn->host.name,
data->conn->host.name,
sasl->mutual_auth, NULL,
&conn->krb5,
&resp, &len);
Expand Down
4 changes: 2 additions & 2 deletions lib/easy.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -1060,7 +1060,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
unsigned int i;
unsigned int count = data->state.tempcount;
struct tempbuf writebuf[3]; /* there can only be three */
struct connectdata *conn = data->easy_conn;
struct connectdata *conn = data->conn;
struct Curl_easy *saved_data = NULL;

/* copy the structs to allow for immediate re-pausing */
Expand Down
4 changes: 2 additions & 2 deletions lib/getinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -390,7 +390,7 @@ static CURLcode getinfo_slist(struct Curl_easy *data, CURLINFO info,
param_slistp;
struct curl_tlssessioninfo *tsi = &data->tsi;
#ifdef USE_SSL
struct connectdata *conn = data->easy_conn;
struct connectdata *conn = data->conn;
#endif

*tsip = tsi;
Expand Down
6 changes: 3 additions & 3 deletions lib/http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -800,15 +800,15 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
H2BUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - %zu bytes out of buffer"
", stream %u\n",
len - nread, stream_id));
data_s->easy_conn->proto.httpc.pause_stream_id = stream_id;
data_s->conn->proto.httpc.pause_stream_id = stream_id;

return NGHTTP2_ERR_PAUSE;
}

/* pause execution of nghttp2 if we received data for another handle
in order to process them first. */
if(conn->data != data_s) {
data_s->easy_conn->proto.httpc.pause_stream_id = stream_id;
data_s->conn->proto.httpc.pause_stream_id = stream_id;

return NGHTTP2_ERR_PAUSE;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/http_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -643,7 +643,7 @@ static CURLcode CONNECT(struct connectdata *conn,

void Curl_connect_free(struct Curl_easy *data)
{
struct connectdata *conn = data->easy_conn;
struct connectdata *conn = data->conn;
struct http_connect_state *s = conn->connect_state;
if(s) {
free(s);
Expand Down
Loading

0 comments on commit ba24323

Please sign in to comment.