multi->num_alive--;
if(easy->easy_conn &&
- easy->easy_handle->state.is_in_pipeline &&
+ (easy->easy_conn->send_pipe->size +
+ easy->easy_conn->recv_pipe->size > 1) &&
easy->state > CURLM_STATE_WAITDO &&
easy->state < CURLM_STATE_COMPLETED) {
/* If the handle is in a pipeline and has started sending off its
infof(easy->easy_handle, "Pipe broke: handle 0x%x, url = %s\n",
easy, easy->easy_handle->state.path);
- if(easy->easy_handle->state.is_in_pipeline) {
+ if(easy->state != CURLM_STATE_COMPLETED) {
/* Head back to the CONNECT state */
multistate(easy, CURLM_STATE_CONNECT);
- easy->easy_handle->state.is_in_pipeline = FALSE;
result = CURLM_CALL_MULTI_PERFORM;
easy->result = CURLE_OK;
}
- else {
- easy->result = CURLE_COULDNT_CONNECT;
- multistate(easy, CURLM_STATE_COMPLETED);
- }
easy->easy_handle->state.pipe_broke = FALSE;
easy->easy_conn = NULL;
easy->result = addHandleToSendOrPendPipeline(easy->easy_handle,
easy->easy_conn);
if(CURLE_OK == easy->result) {
- if (easy->easy_handle->state.is_in_pipeline) {
- multistate(easy, CURLM_STATE_WAITDO);
- if(isHandleAtHead(easy->easy_handle,
- easy->easy_conn->send_pipe))
- result = CURLM_CALL_MULTI_PERFORM;
- }
+ if(async)
+ /* We're now waiting for an asynchronous name lookup */
+ multistate(easy, CURLM_STATE_WAITRESOLVE);
else {
- if(async)
- /* We're now waiting for an asynchronous name lookup */
- multistate(easy, CURLM_STATE_WAITRESOLVE);
+ /* after the connect has been sent off, go WAITCONNECT unless the
+ protocol connect is already done and we can go directly to
+ WAITDO! */
+ result = CURLM_CALL_MULTI_PERFORM;
+
+ if(protocol_connect)
+ multistate(easy, CURLM_STATE_WAITDO);
else {
- /* after the connect has been sent off, go WAITCONNECT unless the
- protocol connect is already done and we can go directly to
- WAITDO! */
- result = CURLM_CALL_MULTI_PERFORM;
-
- if(protocol_connect)
- multistate(easy, CURLM_STATE_WAITDO);
- else {
#ifndef CURL_DISABLE_HTTP
- if(easy->easy_conn->bits.tunnel_connecting)
- multistate(easy, CURLM_STATE_WAITPROXYCONNECT);
- else
+ if(easy->easy_conn->bits.tunnel_connecting)
+ multistate(easy, CURLM_STATE_WAITPROXYCONNECT);
+ else
#endif
- multistate(easy, CURLM_STATE_WAITCONNECT);
- }
+ multistate(easy, CURLM_STATE_WAITCONNECT);
}
}
}
easy->easy_conn->bits.close = TRUE;
Curl_removeHandleFromPipeline(easy->easy_handle,
easy->easy_conn->recv_pipe);
- easy->easy_handle->state.is_in_pipeline = FALSE;
if(CURL_SOCKET_BAD != easy->easy_conn->sock[SECONDARYSOCKET]) {
/* if we failed anywhere, we must clean up the secondary socket if
easy->easy_conn->recv_pipe);
/* Check if we can move pending requests to send pipe */
checkPendPipeline(easy->easy_conn);
- easy->easy_handle->state.is_in_pipeline = FALSE;
+
if(!retry) {
/* if the URL is a follow-location and not just a retried request
then figure out the URL here */
easy->easy_conn->recv_pipe);
/* Check if we can move pending requests to send pipe */
checkPendPipeline(easy->easy_conn);
- easy->easy_handle->state.is_in_pipeline = FALSE;
if(easy->easy_conn->bits.stream_was_rewound) {
/* This request read past its response boundary so we quickly
/* NOTE: no attempt to disconnect connections must be made
in the case blocks above - cleanup happens only here */
- easy->easy_handle->state.is_in_pipeline = FALSE;
easy->easy_handle->state.pipe_broke = FALSE;
if(easy->easy_conn) {
/* only for debugging, scan through all connections and see if there's a
pipe reference still identifying this handle */
- if(data->state.is_in_pipeline)
- fprintf(stderr, "CLOSED when in pipeline!\n");
-
if(data->state.connc && data->state.connc->type == CONNCACHE_MULTI) {
struct conncache *c = data->state.connc;
long i;
}
if(match) {
- if(!check->is_in_pipeline) {
- /* The check for a dead socket makes sense only in the
- non-pipelining case */
+ if(pipeLen == 0) {
+ /* The check for a dead socket makes sense only if there
+ are no handles in pipeline */
bool dead = SocketIsDead(check->sock[FIRSTSOCKET]);
if(dead) {
check->data = data;
check->inuse = TRUE; /* mark this as being in use so that no other
handle in a multi stack may nick it */
- if(canPipeline) {
- /* Mark the connection as being in a pipeline */
- check->is_in_pipeline = TRUE;
- }
*usethis = check;
return TRUE; /* yes, we found one to use! */
ConnectionDone(struct connectdata *conn)
{
conn->inuse = FALSE;
- if(!conn->send_pipe && !conn->recv_pipe && !conn->pend_pipe)
- conn->is_in_pipeline = FALSE;
}
/*
if(CURLE_OK == code) {
/* no error */
- if((*in_connect)->is_in_pipeline)
- data->state.is_in_pipeline = TRUE;
+ if((*in_connect)->send_pipe->size +
+ (*in_connect)->recv_pipe->size != 0)
+ /* pipelining */
+ *protocol_done = TRUE;
else {
if(dns || !*asyncp)
/* If an address is available it means that we already have the name