aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-11-18 14:34:55 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-11-18 14:47:15 +0100
commite04ccbd506b349e7841fe45c3e6e09e70a90ea3a (patch)
tree9f7a52c75643962b935bb64b167bae6fb7ec1956
parent1342a96ecfe0d44c4ae977409799c370b836cfe3 (diff)
multi: make multi_runsingle loop internally
simplifies the use of this function at little cost.
-rw-r--r--lib/multi.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/multi.c b/lib/multi.c
index e01baf332..c261a21ff 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -927,7 +927,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
bool protocol_connect = FALSE;
bool dophase_done = FALSE;
bool done = FALSE;
- CURLMcode result = CURLM_OK;
+ CURLMcode result;
struct SingleRequest *k;
long timeout_ms;
int control;
@@ -936,9 +936,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
return CURLM_BAD_EASY_HANDLE;
do {
- /* this is a single-iteration do-while loop just to allow a
- break to skip to the end of it */
bool disconnect_conn = FALSE;
+ result = CURLM_OK;
/* Handle the case when the pipe breaks, i.e., the connection
we're using gets cleaned up and we're left with nothing. */
@@ -1752,7 +1751,7 @@ statemachine_end:
result = CURLM_CALL_MULTI_PERFORM;
}
}
- } WHILE_FALSE; /* just to break out from! */
+ } while(result == CURLM_CALL_MULTI_PERFORM);
if(CURLM_STATE_COMPLETED == data->mstate) {
/* now fill in the Curl_message with this info */
@@ -1797,9 +1796,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
}
sigpipe_ignore(data, &pipe_st);
- do
- result = multi_runsingle(multi, now, data);
- while(CURLM_CALL_MULTI_PERFORM == result);
+ result = multi_runsingle(multi, now, data);
sigpipe_restore(&pipe_st);
if(data->set.wildcardmatch) {
@@ -2269,9 +2266,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
data->easy_conn->cselect_bits = ev_bitmask;
sigpipe_ignore(data, &pipe_st);
- do
- result = multi_runsingle(multi, now, data);
- while(CURLM_CALL_MULTI_PERFORM == result);
+ result = multi_runsingle(multi, now, data);
sigpipe_restore(&pipe_st);
if(data->easy_conn &&
@@ -2313,9 +2308,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
SIGPIPE_VARIABLE(pipe_st);
sigpipe_ignore(data, &pipe_st);
- do
- result = multi_runsingle(multi, now, data);
- while(CURLM_CALL_MULTI_PERFORM == result);
+ result = multi_runsingle(multi, now, data);
sigpipe_restore(&pipe_st);
if(CURLM_OK >= result)