mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE;
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
+ }
+ if (running <= 0) {
+ done = TRUE;
+ break;
}
+
if (mp_timedout || done)
break;
break;
}
- res = CURLM_CALL_MULTI_PERFORM;
}
if (ml_timedout || mp_timedout) {
fprintf(stderr, "curl_multi_perform()\n");
- ret = CURLM_CALL_MULTI_PERFORM;
-
- while (ret == CURLM_CALL_MULTI_PERFORM) {
- ret = curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
+ ret = curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
if (mp_timedout)
break;
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- do {
- ret = curl_multi_perform(multi, &still_running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- } while (ret == CURLM_CALL_MULTI_PERFORM);
+ ret = curl_multi_perform(multi, &still_running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT)
+ mp_timedout = TRUE;
ml_timedout = FALSE;
ml_start = tutil_tvnow();
default:
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- do {
- ret = curl_multi_perform(multi, &still_running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- } while (ret == CURLM_CALL_MULTI_PERFORM);
+ ret = curl_multi_perform(multi, &still_running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT)
+ mp_timedout = TRUE;
break;
}
}
if (ml_timedout || mp_timedout) {
- if (ml_timedout) fprintf(stderr, "ml_timedout\n");
- if (mp_timedout) fprintf(stderr, "mp_timedout\n");
+ if (ml_timedout)
+ fprintf(stderr, "ml_timedout\n");
+ if (mp_timedout)
+ fprintf(stderr, "mp_timedout\n");
fprintf(stderr, "ABORTING TEST, since it seems "
"that it would have run forever.\n");
i = TEST_ERR_RUNS_FOREVER;
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE;
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
- if (mp_timedout || done)
+ if (running <= 0) {
+ done = TRUE;
break;
+ }
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
+ }
+ if (running <= 0) {
#ifdef LIB527
- /* NOTE: this code does not remove the handle from the multi handle
- here, which would be the nice, sane and documented way of working.
- This however tests that the API survives this abuse gracefully. */
- curl_easy_cleanup(curl[current]);
+ /* NOTE: this code does not remove the handle from the multi handle
+ here, which would be the nice, sane and documented way of working.
+ This however tests that the API survives this abuse gracefully. */
+ curl_easy_cleanup(curl[current]);
#endif
- if(++current < NUM_HANDLES) {
- fprintf(stderr, "Advancing to URL %d\n", current);
+ if(++current < NUM_HANDLES) {
+ fprintf(stderr, "Advancing to URL %d\n", current);
#ifdef LIB532
- /* first remove the only handle we use */
- curl_multi_remove_handle(m, curl[0]);
+ /* first remove the only handle we use */
+ curl_multi_remove_handle(m, curl[0]);
- /* make us re-use the same handle all the time, and try resetting
- the handle first too */
- curl_easy_reset(curl[0]);
- test_setopt(curl[0], CURLOPT_URL, URL);
- test_setopt(curl[0], CURLOPT_VERBOSE, 1L);
+ /* make us re-use the same handle all the time, and try resetting
+ the handle first too */
+ curl_easy_reset(curl[0]);
+ test_setopt(curl[0], CURLOPT_URL, URL);
+ test_setopt(curl[0], CURLOPT_VERBOSE, 1L);
- /* re-add it */
- res = (int)curl_multi_add_handle(m, curl[0]);
+ /* re-add it */
+ res = (int)curl_multi_add_handle(m, curl[0]);
#else
- res = (int)curl_multi_add_handle(m, curl[current]);
+ res = (int)curl_multi_add_handle(m, curl[current]);
#endif
- if(res) {
- fprintf(stderr, "add handle failed: %d.\n", res);
- res = 243;
- break;
- }
+ if(res) {
+ fprintf(stderr, "add handle failed: %d.\n", res);
+ res = 243;
+ break;
}
- else
- done = TRUE; /* bail out */
+ }
+ else {
+ done = TRUE; /* bail out */
break;
}
}
- if (mp_timedout || done)
- break;
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
res = 195;
break;
}
-
- res = CURLM_CALL_MULTI_PERFORM;
}
if (ml_timedout || mp_timedout) {
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE; /* bail out */
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
- if (mp_timedout || done)
+ if (running <= 0) {
+ done = TRUE; /* bail out */
break;
+ }
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- if(!current++) {
- fprintf(stderr, "Advancing to URL 1\n");
- /* remove the handle we use */
- curl_multi_remove_handle(m, curl);
-
- /* make us re-use the same handle all the time, and try resetting
- the handle first too */
- curl_easy_reset(curl);
- test_setopt(curl, CURLOPT_URL, libtest_arg2);
- test_setopt(curl, CURLOPT_VERBOSE, 1);
- test_setopt(curl, CURLOPT_FAILONERROR, 1);
-
- /* re-add it */
- res = (int)curl_multi_add_handle(m, curl);
- if(res) {
- fprintf(stderr, "add handle failed: %d.\n", res);
- res = 243;
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
+ }
+ if (running <= 0) {
+ if(!current++) {
+ fprintf(stderr, "Advancing to URL 1\n");
+ /* remove the handle we use */
+ curl_multi_remove_handle(m, curl);
+
+ /* make us re-use the same handle all the time, and try resetting
+ the handle first too */
+ curl_easy_reset(curl);
+ test_setopt(curl, CURLOPT_URL, libtest_arg2);
+ test_setopt(curl, CURLOPT_VERBOSE, 1);
+ test_setopt(curl, CURLOPT_FAILONERROR, 1);
+
+ /* re-add it */
+ res = (int)curl_multi_add_handle(m, curl);
+ if(res) {
+ fprintf(stderr, "add handle failed: %d.\n", res);
+ res = 243;
+ break;
}
- else
- done = TRUE; /* bail out */
+ }
+ else {
+ done = TRUE; /* bail out */
break;
}
}
- if (mp_timedout || done)
- break;
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
switch (code) {
case CURLM_OK:
break;
- case CURLM_CALL_MULTI_PERFORM:
- continue;
default:
return code;
}
while (U) {
- do {
- code = curl_multi_perform(cm, &U);
- } while (code == CURLM_CALL_MULTI_PERFORM);
+ code = curl_multi_perform(cm, &U);
if (U) {
FD_ZERO(&R);
curl_multi_add_handle(multi_handle, http_handle);
/* we start some action by calling perform right away */
- do {
- code = curl_multi_perform(multi_handle, &still_running);
- } while(code == CURLM_CALL_MULTI_PERFORM);
+ code = curl_multi_perform(multi_handle, &still_running);
while(still_running) {
struct timeval timeout;
case 0:
default:
/* timeout or readable/writable sockets */
- do {
- code = curl_multi_perform(multi_handle, &still_running);
- } while(code == CURLM_CALL_MULTI_PERFORM);
+ code = curl_multi_perform(multi_handle, &still_running);
break;
}
}
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE; /* bail out */
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
- if (mp_timedout || done)
+ if (running <= 0) {
+ done = TRUE; /* bail out */
break;
+ }
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
res = 195;
break;
}
-
- res = CURLM_CALL_MULTI_PERFORM;
}
if (ml_timedout || mp_timedout) {
curl_multi_add_handle(mhandle, handle);
- while(CURLM_CALL_MULTI_PERFORM ==
- curl_multi_perform(mhandle, &still_running));
+ curl_multi_perform(mhandle, &still_running);
while(still_running) {
static struct timeval timeout = /* 100 ms */ { 0, 100000L };
goto test_cleanup;
}
else {
- while(CURLM_CALL_MULTI_PERFORM ==
- curl_multi_perform(mhandle, &still_running));
+ curl_multi_perform(mhandle, &still_running);
}
}
{
int numhandles = 0;
CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
- if (result != CURLM_OK && result != CURLM_CALL_MULTI_PERFORM)
- {
+ if (result != CURLM_OK) {
fprintf(stderr, "Curl error on %s: %i (%s)\n",
info, result, curl_multi_strerror(result));
}
int evBitmask, const char* name)
{
int i;
- for (i = 0; i < sockets->count; ++i)
- {
- if (FD_ISSET(sockets->sockets[i], fdset))
- {
+ for (i = 0; i < sockets->count; ++i) {
+ if (FD_ISSET(sockets->sockets[i], fdset)) {
notifyCurl(curl, sockets->sockets[i], evBitmask, name);
}
}