1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

test1531: Add timeout

Previously, the macro TEST_HANG_TIMEOUT was unused, but since there is
looping going on, we might as well add timing instead of removing it.

Closes #2853
This commit is contained in:
Rikard Falkeborn 2018-08-08 00:10:10 +02:00 committed by Daniel Stenberg
parent 8ea0baed3c
commit 96d6d3801e
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -39,6 +39,8 @@ int test(char *URL)
int msgs_left; /* how many messages are left */ int msgs_left; /* how many messages are left */
int res = CURLE_OK; int res = CURLE_OK;
start_test_timing();
global_init(CURL_GLOBAL_ALL); global_init(CURL_GLOBAL_ALL);
/* Allocate one CURL handle per transfer */ /* Allocate one CURL handle per transfer */
@ -59,6 +61,8 @@ int test(char *URL)
/* we start some action by calling perform right away */ /* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running); curl_multi_perform(multi_handle, &still_running);
abort_on_test_timeout();
do { do {
struct timeval timeout; struct timeval timeout;
int rc; /* select() return code */ int rc; /* select() return code */
@ -127,6 +131,8 @@ int test(char *URL)
curl_multi_perform(multi_handle, &still_running); curl_multi_perform(multi_handle, &still_running);
break; break;
} }
abort_on_test_timeout();
} while(still_running); } while(still_running);
/* See how the transfers went */ /* See how the transfers went */
@ -136,14 +142,17 @@ int test(char *URL)
printf("HTTP transfer completed with status %d\n", msg->data.result); printf("HTTP transfer completed with status %d\n", msg->data.result);
break; break;
} }
abort_on_test_timeout();
} while(msg); } while(msg);
test_cleanup:
curl_multi_cleanup(multi_handle); curl_multi_cleanup(multi_handle);
/* Free the CURL handles */ /* Free the CURL handles */
curl_easy_cleanup(easy); curl_easy_cleanup(easy);
curl_global_cleanup(); curl_global_cleanup();
return 0; return res;
} }