1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-11 20:15:03 -05:00

make the loop use a fixed number of attempts to prevent eternal loops

This commit is contained in:
Daniel Stenberg 2004-04-27 10:59:43 +00:00
parent 58f1cc0b5f
commit 2f53da5e7a

View File

@ -20,6 +20,7 @@ int test(char *URL)
int running; int running;
int max_fd; int max_fd;
int rc; int rc;
int loop=100;
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
c = curl_easy_init(); c = curl_easy_init();
@ -78,7 +79,9 @@ int test(char *URL)
rc = select(max_fd+1, &rd, &wr, &exc, &interval); rc = select(max_fd+1, &rd, &wr, &exc, &interval);
fprintf(stderr, "select returned %d\n", rc); fprintf(stderr, "select returned %d\n", rc);
} while(rc); /* we only allow a certain number of loops to avoid hanging here
forever */
} while(rc && (--loop>0));
curl_multi_remove_handle(m, c); curl_multi_remove_handle(m, c);
curl_easy_cleanup(c); curl_easy_cleanup(c);