From df13f8e8c2199b572f19d295e5c59e7502204b3a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 May 2014 10:32:23 +0200 Subject: bits.close: introduce connection close tracking Make all code use connclose() and connkeep() when changing the "close state" for a connection. These two macros take a string argument with an explanation, and debug builds of curl will include that in the debug output. Helps tracking connection re-use/close issues. --- lib/multi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/multi.c') diff --git a/lib/multi.c b/lib/multi.c index 72fde7439..1fb341ca6 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -515,7 +515,7 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, /* If the handle is in a pipeline and has started sending off its request but not received its response yet, we need to close connection. */ - data->easy_conn->bits.close = TRUE; + connclose(data->easy_conn, "Removed with partial response"); /* Set connection owner so that Curl_done() closes it. We can sefely do this here since connection is killed. */ data->easy_conn->data = easy; @@ -1011,7 +1011,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* Force the connection closed because the server could continue to send us stuff at any time. (The disconnect_conn logic used below doesn't work at this point). */ - data->easy_conn->bits.close = TRUE; + connclose(data->easy_conn, "Disconnected with pending data"); data->result = CURLE_OPERATION_TIMEDOUT; multistate(data, CURLM_STATE_COMPLETED); break; @@ -1239,7 +1239,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_DO: if(data->set.connect_only) { /* keep connection open for application to use the socket */ - data->easy_conn->bits.close = FALSE; + connkeep(data->easy_conn, "CONNECT_ONLY"); multistate(data, CURLM_STATE_DONE); data->result = CURLE_OK; result = CURLM_CALL_MULTI_PERFORM; @@ -1525,7 +1525,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, */ if(!(data->easy_conn->handler->flags & PROTOPT_DUAL)) - data->easy_conn->bits.close = TRUE; + connclose(data->easy_conn, "Transfer returned error"); Curl_posttransfer(data); Curl_done(&data->easy_conn, data->result, FALSE); @@ -1705,7 +1705,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* aborted due to progress callback return code must close the connection */ data->result = CURLE_ABORTED_BY_CALLBACK; - data->easy_conn->bits.close = TRUE; + connclose(data->easy_conn, "Aborted by callback"); /* if not yet in DONE state, go there, otherwise COMPLETED */ multistate(data, (data->mstate < CURLM_STATE_DONE)? -- cgit v1.2.3