Loading tests/libtest/lib504.c +33 −10 Original line number Original line Diff line number Diff line Loading @@ -3,6 +3,11 @@ #include <sys/time.h> #include <sys/time.h> #include <sys/types.h> #include <sys/types.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 /* /* * Source code in here hugely as reported in bug report 651464 by * Source code in here hugely as reported in bug report 651464 by * Christopher R. Palmer. * Christopher R. Palmer. Loading @@ -20,8 +25,10 @@ int test(char *URL) int running; int running; int max_fd; int max_fd; int rc; int rc; int loop1 = 10; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); c = curl_easy_init(); c = curl_easy_init(); Loading @@ -38,19 +45,36 @@ int test(char *URL) if(res && (res != CURLM_CALL_MULTI_PERFORM)) if(res && (res != CURLM_CALL_MULTI_PERFORM)) ; /* major failure */ ; /* major failure */ else { else { ml_timedout = FALSE; ml_start = curlx_tvnow(); do { do { struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } fprintf(stderr, "curl_multi_perform()\n"); fprintf(stderr, "curl_multi_perform()\n"); mp_timedout = FALSE; mp_start = curlx_tvnow(); do { do { res = curl_multi_perform(m, &running); res = curl_multi_perform(m, &running); } while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)); if (curlx_tvdiff(curlx_tvnow(), mp_start) > if (loop2 <= 0) MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } } while (res == CURLM_CALL_MULTI_PERFORM); if (mp_timedout) break; break; if(!running) { if(!running) { /* This is where this code is expected to reach */ /* This is where this code is expected to reach */ Loading Loading @@ -84,11 +108,10 @@ int test(char *URL) rc = select_test(max_fd+1, &rd, &wr, &exc, &interval); rc = select_test(max_fd+1, &rd, &wr, &exc, &interval); fprintf(stderr, "select returned %d\n", rc); fprintf(stderr, "select returned %d\n", rc); /* we only allow a certain number of loops to avoid hanging here } while(1); forever */ if (ml_timedout || mp_timedout) { } while(--loop1>0); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if ((loop1 <= 0) || (loop2 <= 0)) { if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); ret = 77; ret = 77; Loading tests/libtest/lib507.c +46 −10 Original line number Original line Diff line number Diff line #include "test.h" #include "test.h" #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 int test(char *URL) int test(char *URL) { { CURL* curls; CURL* curls; Loading @@ -7,8 +12,11 @@ int test(char *URL) int still_running; int still_running; int i = -1; int i = -1; CURLMsg *msg; CURLMsg *msg; int loop1 = 20; CURLMcode res; int loop2 = 40; struct timeval ml_start; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; multi = curl_multi_init(); multi = curl_multi_init(); Loading @@ -16,21 +24,41 @@ int test(char *URL) curl_easy_setopt(curls, CURLOPT_URL, URL); curl_easy_setopt(curls, CURLOPT_URL, URL); curl_multi_add_handle(multi, curls); curl_multi_add_handle(multi, curls); while ((--loop1>0) && (CURLM_CALL_MULTI_PERFORM == mp_timedout = FALSE; curl_multi_perform(multi, &still_running))); mp_start = curlx_tvnow(); while ((loop1>0) && (--loop2>0) && (still_running)) { do { res = curl_multi_perform(multi, &still_running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } } while (res == CURLM_CALL_MULTI_PERFORM); ml_timedout = FALSE; ml_start = curlx_tvnow(); while ((!ml_timedout) && (!mp_timedout) && (still_running)) { struct timeval timeout; struct timeval timeout; int rc; int rc; fd_set fdread; fd_set fdread; fd_set fdwrite; fd_set fdwrite; fd_set fdexcep; fd_set fdexcep; int maxfd; int maxfd; FD_ZERO(&fdread); FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); FD_ZERO(&fdexcep); timeout.tv_sec = 1; timeout.tv_sec = 1; timeout.tv_usec = 0; timeout.tv_usec = 0; if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); rc = select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); rc = select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); switch(rc) { switch(rc) { Loading @@ -38,14 +66,22 @@ int test(char *URL) break; break; case 0: case 0: default: default: loop1 = 20; mp_timedout = FALSE; while ((--loop1>0) && (CURLM_CALL_MULTI_PERFORM == mp_start = curlx_tvnow(); curl_multi_perform(multi, &still_running))); do { res = curl_multi_perform(multi, &still_running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } } while (res == CURLM_CALL_MULTI_PERFORM); break; break; } } } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); i = 77; i = 77; Loading tests/libtest/lib509.c +32 −9 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,11 @@ #include <openssl/bio.h> #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/ssl.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 int portnum; /* the HTTPS port number we use */ int portnum; /* the HTTPS port number we use */ typedef struct sslctxparm_st { typedef struct sslctxparm_st { Loading Loading @@ -175,8 +180,10 @@ int test(char *URL) int i = 0; int i = 0; CURLMsg *msg; CURLMsg *msg; int loop1 = 40; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; if(arg2) { if(arg2) { portnum = atoi(arg2); portnum = atoi(arg2); Loading Loading @@ -208,24 +215,39 @@ int test(char *URL) res = curl_multi_add_handle(multi, p.curl); res = curl_multi_add_handle(multi, p.curl); while ((--loop1>0) && (loop2>0) && (!done)) { ml_timedout = FALSE; ml_start = curlx_tvnow(); while (!done) { fd_set rd, wr, exc; fd_set rd, wr, exc; int max_fd; int max_fd; struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } mp_timedout = FALSE; mp_start = curlx_tvnow(); while (res == CURLM_CALL_MULTI_PERFORM) { res = curl_multi_perform(multi, &running); res = curl_multi_perform(multi, &running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } fprintf(stderr, "running=%d res=%d\n",running,res); fprintf(stderr, "running=%d res=%d\n",running,res); if (running <= 0) { if (running <= 0) { done = TRUE; done = TRUE; break; break; } } } } if ((loop2 <= 0) || (done)) if (mp_timedout || done) break; break; if (res != CURLM_OK) { if (res != CURLM_OK) { Loading Loading @@ -254,8 +276,9 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; res = CURLM_CALL_MULTI_PERFORM; } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); i = 77; i = 77; Loading @@ -268,7 +291,7 @@ int test(char *URL) } } } } if ((loop1>0) && (loop2>0)) { if ((!ml_timedout) && (!mp_timedout)) { fprintf(stderr, "all done\n"); fprintf(stderr, "all done\n"); } } Loading tests/libtest/lib525.c +31 −8 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,11 @@ #include <sys/stat.h> #include <sys/stat.h> #include <fcntl.h> #include <fcntl.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 int test(char *URL) int test(char *URL) { { int res = 0; int res = 0; Loading @@ -24,8 +29,10 @@ int test(char *URL) int running; int running; char done=FALSE; char done=FALSE; CURLM *m; CURLM *m; int loop1 = 40; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; if (!arg2) { if (!arg2) { fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n"); fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n"); Loading Loading @@ -84,23 +91,38 @@ int test(char *URL) res = (int)curl_multi_add_handle(m, curl); res = (int)curl_multi_add_handle(m, curl); while ((--loop1>0) && (loop2>0) && (!done)) { ml_timedout = FALSE; ml_start = curlx_tvnow(); while (!done) { fd_set rd, wr, exc; fd_set rd, wr, exc; int max_fd; int max_fd; struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } mp_timedout = FALSE; mp_start = curlx_tvnow(); while (res == CURLM_CALL_MULTI_PERFORM) { res = (int)curl_multi_perform(m, &running); res = (int)curl_multi_perform(m, &running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } if (running <= 0) { if (running <= 0) { done = TRUE; done = TRUE; break; break; } } } } if ((loop2 <= 0) || (done)) if (mp_timedout || done) break; break; if (res != CURLM_OK) { if (res != CURLM_OK) { Loading Loading @@ -128,8 +150,9 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; res = CURLM_CALL_MULTI_PERFORM; } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); res = 77; res = 77; Loading tests/libtest/lib526.c +31 −8 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,11 @@ #include <sys/stat.h> #include <sys/stat.h> #include <fcntl.h> #include <fcntl.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 #define NUM_HANDLES 4 #define NUM_HANDLES 4 int test(char *URL) int test(char *URL) Loading @@ -44,8 +49,10 @@ int test(char *URL) CURLM *m; CURLM *m; int current=0; int current=0; int i; int i; int loop1 = 40; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; /* In windows, this will init the winsock stuff */ /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); Loading @@ -67,19 +74,34 @@ int test(char *URL) res = (int)curl_multi_add_handle(m, curl[current]); res = (int)curl_multi_add_handle(m, curl[current]); ml_timedout = FALSE; ml_start = curlx_tvnow(); fprintf(stderr, "Start at URL 0\n"); fprintf(stderr, "Start at URL 0\n"); while ((--loop1>0) && (loop2>0) && (!done)) { while (!done) { fd_set rd, wr, exc; fd_set rd, wr, exc; int max_fd; int max_fd; struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } mp_timedout = FALSE; mp_start = curlx_tvnow(); while (res == CURLM_CALL_MULTI_PERFORM) { res = (int)curl_multi_perform(m, &running); res = (int)curl_multi_perform(m, &running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } if (running <= 0) { if (running <= 0) { #ifdef LIB527 #ifdef LIB527 /* NOTE: this code does not remove the handle from the multi handle /* NOTE: this code does not remove the handle from the multi handle Loading Loading @@ -115,7 +137,7 @@ int test(char *URL) break; break; } } } } if ((loop2 <= 0) || (done)) if (mp_timedout || done) break; break; if (res != CURLM_OK) { if (res != CURLM_OK) { Loading Loading @@ -143,8 +165,9 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; res = CURLM_CALL_MULTI_PERFORM; } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); res = 77; res = 77; Loading Loading
tests/libtest/lib504.c +33 −10 Original line number Original line Diff line number Diff line Loading @@ -3,6 +3,11 @@ #include <sys/time.h> #include <sys/time.h> #include <sys/types.h> #include <sys/types.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 /* /* * Source code in here hugely as reported in bug report 651464 by * Source code in here hugely as reported in bug report 651464 by * Christopher R. Palmer. * Christopher R. Palmer. Loading @@ -20,8 +25,10 @@ int test(char *URL) int running; int running; int max_fd; int max_fd; int rc; int rc; int loop1 = 10; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); c = curl_easy_init(); c = curl_easy_init(); Loading @@ -38,19 +45,36 @@ int test(char *URL) if(res && (res != CURLM_CALL_MULTI_PERFORM)) if(res && (res != CURLM_CALL_MULTI_PERFORM)) ; /* major failure */ ; /* major failure */ else { else { ml_timedout = FALSE; ml_start = curlx_tvnow(); do { do { struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } fprintf(stderr, "curl_multi_perform()\n"); fprintf(stderr, "curl_multi_perform()\n"); mp_timedout = FALSE; mp_start = curlx_tvnow(); do { do { res = curl_multi_perform(m, &running); res = curl_multi_perform(m, &running); } while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)); if (curlx_tvdiff(curlx_tvnow(), mp_start) > if (loop2 <= 0) MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } } while (res == CURLM_CALL_MULTI_PERFORM); if (mp_timedout) break; break; if(!running) { if(!running) { /* This is where this code is expected to reach */ /* This is where this code is expected to reach */ Loading Loading @@ -84,11 +108,10 @@ int test(char *URL) rc = select_test(max_fd+1, &rd, &wr, &exc, &interval); rc = select_test(max_fd+1, &rd, &wr, &exc, &interval); fprintf(stderr, "select returned %d\n", rc); fprintf(stderr, "select returned %d\n", rc); /* we only allow a certain number of loops to avoid hanging here } while(1); forever */ if (ml_timedout || mp_timedout) { } while(--loop1>0); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if ((loop1 <= 0) || (loop2 <= 0)) { if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); ret = 77; ret = 77; Loading
tests/libtest/lib507.c +46 −10 Original line number Original line Diff line number Diff line #include "test.h" #include "test.h" #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 int test(char *URL) int test(char *URL) { { CURL* curls; CURL* curls; Loading @@ -7,8 +12,11 @@ int test(char *URL) int still_running; int still_running; int i = -1; int i = -1; CURLMsg *msg; CURLMsg *msg; int loop1 = 20; CURLMcode res; int loop2 = 40; struct timeval ml_start; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; multi = curl_multi_init(); multi = curl_multi_init(); Loading @@ -16,21 +24,41 @@ int test(char *URL) curl_easy_setopt(curls, CURLOPT_URL, URL); curl_easy_setopt(curls, CURLOPT_URL, URL); curl_multi_add_handle(multi, curls); curl_multi_add_handle(multi, curls); while ((--loop1>0) && (CURLM_CALL_MULTI_PERFORM == mp_timedout = FALSE; curl_multi_perform(multi, &still_running))); mp_start = curlx_tvnow(); while ((loop1>0) && (--loop2>0) && (still_running)) { do { res = curl_multi_perform(multi, &still_running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } } while (res == CURLM_CALL_MULTI_PERFORM); ml_timedout = FALSE; ml_start = curlx_tvnow(); while ((!ml_timedout) && (!mp_timedout) && (still_running)) { struct timeval timeout; struct timeval timeout; int rc; int rc; fd_set fdread; fd_set fdread; fd_set fdwrite; fd_set fdwrite; fd_set fdexcep; fd_set fdexcep; int maxfd; int maxfd; FD_ZERO(&fdread); FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); FD_ZERO(&fdexcep); timeout.tv_sec = 1; timeout.tv_sec = 1; timeout.tv_usec = 0; timeout.tv_usec = 0; if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); rc = select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); rc = select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); switch(rc) { switch(rc) { Loading @@ -38,14 +66,22 @@ int test(char *URL) break; break; case 0: case 0: default: default: loop1 = 20; mp_timedout = FALSE; while ((--loop1>0) && (CURLM_CALL_MULTI_PERFORM == mp_start = curlx_tvnow(); curl_multi_perform(multi, &still_running))); do { res = curl_multi_perform(multi, &still_running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } } while (res == CURLM_CALL_MULTI_PERFORM); break; break; } } } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); i = 77; i = 77; Loading
tests/libtest/lib509.c +32 −9 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,11 @@ #include <openssl/bio.h> #include <openssl/bio.h> #include <openssl/ssl.h> #include <openssl/ssl.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 int portnum; /* the HTTPS port number we use */ int portnum; /* the HTTPS port number we use */ typedef struct sslctxparm_st { typedef struct sslctxparm_st { Loading Loading @@ -175,8 +180,10 @@ int test(char *URL) int i = 0; int i = 0; CURLMsg *msg; CURLMsg *msg; int loop1 = 40; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; if(arg2) { if(arg2) { portnum = atoi(arg2); portnum = atoi(arg2); Loading Loading @@ -208,24 +215,39 @@ int test(char *URL) res = curl_multi_add_handle(multi, p.curl); res = curl_multi_add_handle(multi, p.curl); while ((--loop1>0) && (loop2>0) && (!done)) { ml_timedout = FALSE; ml_start = curlx_tvnow(); while (!done) { fd_set rd, wr, exc; fd_set rd, wr, exc; int max_fd; int max_fd; struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } mp_timedout = FALSE; mp_start = curlx_tvnow(); while (res == CURLM_CALL_MULTI_PERFORM) { res = curl_multi_perform(multi, &running); res = curl_multi_perform(multi, &running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } fprintf(stderr, "running=%d res=%d\n",running,res); fprintf(stderr, "running=%d res=%d\n",running,res); if (running <= 0) { if (running <= 0) { done = TRUE; done = TRUE; break; break; } } } } if ((loop2 <= 0) || (done)) if (mp_timedout || done) break; break; if (res != CURLM_OK) { if (res != CURLM_OK) { Loading Loading @@ -254,8 +276,9 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; res = CURLM_CALL_MULTI_PERFORM; } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); i = 77; i = 77; Loading @@ -268,7 +291,7 @@ int test(char *URL) } } } } if ((loop1>0) && (loop2>0)) { if ((!ml_timedout) && (!mp_timedout)) { fprintf(stderr, "all done\n"); fprintf(stderr, "all done\n"); } } Loading
tests/libtest/lib525.c +31 −8 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,11 @@ #include <sys/stat.h> #include <sys/stat.h> #include <fcntl.h> #include <fcntl.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 int test(char *URL) int test(char *URL) { { int res = 0; int res = 0; Loading @@ -24,8 +29,10 @@ int test(char *URL) int running; int running; char done=FALSE; char done=FALSE; CURLM *m; CURLM *m; int loop1 = 40; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; if (!arg2) { if (!arg2) { fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n"); fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n"); Loading Loading @@ -84,23 +91,38 @@ int test(char *URL) res = (int)curl_multi_add_handle(m, curl); res = (int)curl_multi_add_handle(m, curl); while ((--loop1>0) && (loop2>0) && (!done)) { ml_timedout = FALSE; ml_start = curlx_tvnow(); while (!done) { fd_set rd, wr, exc; fd_set rd, wr, exc; int max_fd; int max_fd; struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } mp_timedout = FALSE; mp_start = curlx_tvnow(); while (res == CURLM_CALL_MULTI_PERFORM) { res = (int)curl_multi_perform(m, &running); res = (int)curl_multi_perform(m, &running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } if (running <= 0) { if (running <= 0) { done = TRUE; done = TRUE; break; break; } } } } if ((loop2 <= 0) || (done)) if (mp_timedout || done) break; break; if (res != CURLM_OK) { if (res != CURLM_OK) { Loading Loading @@ -128,8 +150,9 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; res = CURLM_CALL_MULTI_PERFORM; } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); res = 77; res = 77; Loading
tests/libtest/lib526.c +31 −8 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,11 @@ #include <sys/stat.h> #include <sys/stat.h> #include <fcntl.h> #include <fcntl.h> #include "timeval.h" #define MAIN_LOOP_HANG_TIMEOUT 45 * 1000 #define MULTI_PERFORM_HANG_TIMEOUT 30 * 1000 #define NUM_HANDLES 4 #define NUM_HANDLES 4 int test(char *URL) int test(char *URL) Loading @@ -44,8 +49,10 @@ int test(char *URL) CURLM *m; CURLM *m; int current=0; int current=0; int i; int i; int loop1 = 40; struct timeval ml_start; int loop2 = 20; struct timeval mp_start; char ml_timedout = FALSE; char mp_timedout = FALSE; /* In windows, this will init the winsock stuff */ /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); Loading @@ -67,19 +74,34 @@ int test(char *URL) res = (int)curl_multi_add_handle(m, curl[current]); res = (int)curl_multi_add_handle(m, curl[current]); ml_timedout = FALSE; ml_start = curlx_tvnow(); fprintf(stderr, "Start at URL 0\n"); fprintf(stderr, "Start at URL 0\n"); while ((--loop1>0) && (loop2>0) && (!done)) { while (!done) { fd_set rd, wr, exc; fd_set rd, wr, exc; int max_fd; int max_fd; struct timeval interval; struct timeval interval; interval.tv_sec = 1; interval.tv_sec = 1; interval.tv_usec = 0; interval.tv_usec = 0; loop2 = 20; while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { if (curlx_tvdiff(curlx_tvnow(), ml_start) > MAIN_LOOP_HANG_TIMEOUT) { ml_timedout = TRUE; break; } mp_timedout = FALSE; mp_start = curlx_tvnow(); while (res == CURLM_CALL_MULTI_PERFORM) { res = (int)curl_multi_perform(m, &running); res = (int)curl_multi_perform(m, &running); if (curlx_tvdiff(curlx_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { mp_timedout = TRUE; break; } if (running <= 0) { if (running <= 0) { #ifdef LIB527 #ifdef LIB527 /* NOTE: this code does not remove the handle from the multi handle /* NOTE: this code does not remove the handle from the multi handle Loading Loading @@ -115,7 +137,7 @@ int test(char *URL) break; break; } } } } if ((loop2 <= 0) || (done)) if (mp_timedout || done) break; break; if (res != CURLM_OK) { if (res != CURLM_OK) { Loading Loading @@ -143,8 +165,9 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; res = CURLM_CALL_MULTI_PERFORM; } } if ((loop1 <= 0) || (loop2 <= 0)) { if (ml_timedout || mp_timedout) { fprintf(stderr, "loop1: %d loop2: %d \n", loop1, loop2); if (ml_timedout) fprintf(stderr, "ml_timedout\n"); if (mp_timedout) fprintf(stderr, "mp_timedout\n"); fprintf(stderr, "ABORTING TEST, since it seems " fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); "that it would have run forever.\n"); res = 77; res = 77; Loading