test575: do not fail with threaded DNS resolver

This commit is contained in:
Kamil Dudka 2010-06-17 17:07:15 +02:00
parent 43edcc4a2e
commit d63bdba097
2 changed files with 6 additions and 7 deletions

View File

@ -6,6 +6,9 @@
Changelog Changelog
Kamil Dudka (17 June 2010)
- Improve test575 in order to not fail with threaded DNS resolver.
Version 7.21.0 (16 June 2010) Version 7.21.0 (16 June 2010)
Daniel Stenberg (5 June 2010) Daniel Stenberg (5 June 2010)

View File

@ -71,7 +71,7 @@ int test(char *URL)
curl_multi_perform(mhandle, &still_running)); curl_multi_perform(mhandle, &still_running));
while(still_running) { while(still_running) {
struct timeval timeout; static struct timeval timeout = /* 100 ms */ { 0, 100000L };
int rc; int rc;
fd_set fdread; fd_set fdread;
fd_set fdwrite; fd_set fdwrite;
@ -80,23 +80,19 @@ int test(char *URL)
FD_ZERO(&fdread); FD_ZERO(&fdread);
FD_ZERO(&fdwrite); FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep); FD_ZERO(&fdexcep);
timeout.tv_sec = 3;
timeout.tv_usec = 0;
m = curl_multi_fdset(mhandle, &fdread, &fdwrite, &fdexcep, &max_fdset); m = curl_multi_fdset(mhandle, &fdread, &fdwrite, &fdexcep, &max_fdset);
if(m != CURLM_OK) { if(m != CURLM_OK) {
fprintf(stderr, "curl_multi_fdset() error\n"); fprintf(stderr, "curl_multi_fdset() error\n");
goto test_cleanup; goto test_cleanup;
} }
/* We call select(max_fdset + 1, ...), specially in case of (maxfd == -1),
* we call select(0, ...), which is basically equal to sleep. */
rc = select(max_fdset + 1, &fdread, &fdwrite, &fdexcep, &timeout); rc = select(max_fdset + 1, &fdread, &fdwrite, &fdexcep, &timeout);
if(rc == -1) { if(rc == -1) {
fprintf(stderr, "select() error\n"); fprintf(stderr, "select() error\n");
goto test_cleanup; goto test_cleanup;
} }
else if(rc == 0) {
fprintf(stderr, "select() timeout!\n");
goto test_cleanup;
}
else { else {
while(CURLM_CALL_MULTI_PERFORM == while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform(mhandle, &still_running)); curl_multi_perform(mhandle, &still_running));