/* 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;
/* 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;
if(CURLE_OK == data->result) {
/* after init, go CONNECT */
multistate(data, CURLM_STATE_CONNECT);
- Curl_pgrsTime(data, TIMER_STARTSINGLE);
+ Curl_pgrsTime(data, TIMER_STARTOP);
result = CURLM_CALL_MULTI_PERFORM;
}
break;
case CURLM_STATE_CONNECT:
/* Connect. We want to get a connection identifier filled in. */
+ Curl_pgrsTime(data, TIMER_STARTSINGLE);
data->result = Curl_connect(data, &data->easy_conn,
&async, &protocol_connect);
if(CURLE_NO_CONNECTION_AVAILABLE == data->result) {
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;
*/
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);
Curl_multi_process_pending_handles(multi);
/* post-transfer command */
- res = Curl_done(&data->easy_conn, CURLE_OK, FALSE);
+ res = Curl_done(&data->easy_conn, data->result, FALSE);
/* allow a previously set error code take precedence */
if(!data->result)
/* 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)?
conn = Curl_conncache_find_first_connection(multi->conn_cache);
while(conn) {
+ SIGPIPE_VARIABLE(pipe_st);
conn->data = multi->closure_handle;
+ sigpipe_ignore(conn->data, &pipe_st);
/* This will remove the connection from the cache */
(void)Curl_disconnect(conn, FALSE);
+ sigpipe_restore(&pipe_st);
conn = Curl_conncache_find_first_connection(multi->conn_cache);
}