diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-05-11 11:41:10 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-05-18 09:33:47 +0200 |
commit | 72105ebf0565761c38805ba699b25d8c5520ffb0 (patch) | |
tree | cec40ae439d767db5546042f51dcd8e152c1cfe1 /lib/multi.c | |
parent | 38bd6bf0bb4ffc031c8d810f103d6ec1bc7fbb90 (diff) |
http2: set default concurrency, fix ConnectionExists for multiplex
Diffstat (limited to 'lib/multi.c')
-rw-r--r-- | lib/multi.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/multi.c b/lib/multi.c index c6bfe23c9..cff3b8d55 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -928,6 +928,34 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, return CURLM_OK; } +/* + * Curl_multi_connchanged() is called to tell that there is a connection in + * this multi handle that has changed state (pipelining become possible, the + * number of allowed streams changed or similar), and a subsequent use of this + * multi handle should move CONNECT_PEND handles back to CONNECT to have them + * retry. + */ +void Curl_multi_connchanged(struct Curl_multi *multi) +{ + multi->recheckstate = TRUE; +} + +/* + * multi_ischanged() is called + * + * Returns TRUE/FALSE whether the state is changed to trigger a CONNECT_PEND + * => CONNECT action. + * + * Set 'clear' to TRUE to have it also clear the state variable. + */ +static bool multi_ischanged(struct Curl_multi *multi, bool clear) +{ + bool retval = multi->recheckstate; + if(clear) + multi->recheckstate = FALSE; + return retval; +} + static CURLMcode multi_runsingle(struct Curl_multi *multi, struct timeval now, struct SessionHandle *data) @@ -979,6 +1007,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, return CURLM_INTERNAL_ERROR; } + if(multi_ischanged(multi, TRUE)) { + DEBUGF(infof(data, "multi changed, check CONNECT_PEND queue!\n")); + Curl_multi_process_pending_handles(multi); + } + if(data->easy_conn && data->mstate > CURLM_STATE_CONNECT && data->mstate < CURLM_STATE_COMPLETED) /* Make sure we set the connection's current owner */ @@ -1750,7 +1783,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(data, CURLM_STATE_MSGSENT); } - } while(rc == CURLM_CALL_MULTI_PERFORM); + } while((rc == CURLM_CALL_MULTI_PERFORM) || multi_ischanged(multi, FALSE)); data->result = result; |