libtests: stop checking for CURLM_CALL_MULTI_PERFORM
CURLM_CALL_MULTI_PERFORM stopped being a valid return code from curl_multi_perform back in 7.20.0. All the libcurl tests are ajusted to this and no longer check for this return code. Makes them simpler.
This commit is contained in:
Родитель
78480892cd
Коммит
fb48e2050b
|
@ -103,18 +103,17 @@ int test(char *URL)
|
|||
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;
|
||||
|
||||
|
@ -140,7 +139,6 @@ int test(char *URL)
|
|||
break;
|
||||
}
|
||||
|
||||
res = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
|
||||
if (ml_timedout || mp_timedout) {
|
||||
|
|
|
@ -106,15 +106,11 @@ int test(char *URL)
|
|||
|
||||
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;
|
||||
|
|
|
@ -75,14 +75,10 @@ int test(char *URL)
|
|||
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();
|
||||
|
@ -116,20 +112,18 @@ int test(char *URL)
|
|||
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;
|
||||
|
|
|
@ -151,20 +151,16 @@ int test(char *URL)
|
|||
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;
|
||||
}
|
||||
}
|
||||
if (mp_timedout || done)
|
||||
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 (res != CURLM_OK) {
|
||||
fprintf(stderr, "not okay???\n");
|
||||
|
|
|
@ -149,50 +149,47 @@ int test(char *URL)
|
|||
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");
|
||||
|
@ -215,8 +212,6 @@ int test(char *URL)
|
|||
res = 195;
|
||||
break;
|
||||
}
|
||||
|
||||
res = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
|
||||
if (ml_timedout || mp_timedout) {
|
||||
|
|
|
@ -161,20 +161,16 @@ int test(char *URL)
|
|||
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;
|
||||
}
|
||||
}
|
||||
if (mp_timedout || done)
|
||||
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;
|
||||
}
|
||||
|
||||
if (res != CURLM_OK) {
|
||||
fprintf(stderr, "not okay???\n");
|
||||
|
|
|
@ -99,41 +99,38 @@ int test(char *URL)
|
|||
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);
|
||||
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);
|
||||
/* 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;
|
||||
}
|
||||
/* 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");
|
||||
|
|
|
@ -59,8 +59,6 @@ static CURLMcode perform(CURLM * multi)
|
|||
switch (code) {
|
||||
case CURLM_OK:
|
||||
break;
|
||||
case CURLM_CALL_MULTI_PERFORM:
|
||||
continue;
|
||||
default:
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -87,9 +87,7 @@ static int loop(CURLM *cm, const char* url, const char* userpwd,
|
|||
|
||||
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);
|
||||
|
|
|
@ -63,9 +63,7 @@ int test(char *URL)
|
|||
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;
|
||||
|
@ -100,9 +98,7 @@ int test(char *URL)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,20 +98,16 @@ int test(char *URL)
|
|||
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;
|
||||
}
|
||||
}
|
||||
if (mp_timedout || done)
|
||||
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;
|
||||
}
|
||||
|
||||
if (res != CURLM_OK) {
|
||||
fprintf(stderr, "not okay???\n");
|
||||
|
@ -134,8 +130,6 @@ int test(char *URL)
|
|||
res = 195;
|
||||
break;
|
||||
}
|
||||
|
||||
res = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
|
||||
if (ml_timedout || mp_timedout) {
|
||||
|
|
|
@ -81,8 +81,7 @@ int test(char *URL)
|
|||
|
||||
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 };
|
||||
|
@ -108,8 +107,7 @@ int test(char *URL)
|
|||
goto test_cleanup;
|
||||
}
|
||||
else {
|
||||
while(CURLM_CALL_MULTI_PERFORM ==
|
||||
curl_multi_perform(mhandle, &still_running));
|
||||
curl_multi_perform(mhandle, &still_running);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,8 +182,7 @@ static void notifyCurl(CURL* curl, curl_socket_t s, int evBitmask,
|
|||
{
|
||||
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));
|
||||
}
|
||||
|
@ -196,10 +195,8 @@ static void checkFdSet(CURL* curl, struct Sockets* sockets, fd_set* fdset,
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче