aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/perf_get_concurrent.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-05-26 17:06:04 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-05-26 17:06:04 +0300
commitdc4af6f6001a35f965a088d9b20d6a26cd94254a (patch)
treeb3e6cbfaa3d96861ad112787ec53a237dce20eff /src/testcurl/perf_get_concurrent.c
parent49edf6b94d0aa8588a0ac31801a597c99d405c44 (diff)
downloadlibmicrohttpd-dc4af6f6001a35f965a088d9b20d6a26cd94254a.tar.gz
libmicrohttpd-dc4af6f6001a35f965a088d9b20d6a26cd94254a.zip
perf_get_concurrent11: added new test, fixed "11" mode detection
Diffstat (limited to 'src/testcurl/perf_get_concurrent.c')
-rw-r--r--src/testcurl/perf_get_concurrent.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c
index 2c685867..336a1d1e 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -41,6 +41,7 @@
41#include <time.h> 41#include <time.h>
42#include <pthread.h> 42#include <pthread.h>
43#include "gauger.h" 43#include "gauger.h"
44#include "mhd_has_in_name.h"
44 45
45#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 46#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2
46#undef CPU_COUNT 47#undef CPU_COUNT
@@ -182,23 +183,23 @@ thread_gets (void *param)
182 unsigned int i; 183 unsigned int i;
183 char * const url = (char*) param; 184 char * const url = (char*) param;
184 185
186 c = curl_easy_init ();
187 curl_easy_setopt (c, CURLOPT_URL, url);
188 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
189 curl_easy_setopt (c, CURLOPT_WRITEDATA, NULL);
190 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1L);
191 curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
192 if (oneone)
193 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
194 else
195 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
196 curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
197 /* NOTE: use of CONNECTTIMEOUT without also
198 setting NOSIGNAL results in really weird
199 crashes on my system! */
200 curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L);
185 for (i=0;i<ROUNDS;i++) 201 for (i=0;i<ROUNDS;i++)
186 { 202 {
187 c = curl_easy_init ();
188 curl_easy_setopt (c, CURLOPT_URL, url);
189 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
190 curl_easy_setopt (c, CURLOPT_WRITEDATA, NULL);
191 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
192 curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
193 if (oneone)
194 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
195 else
196 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
197 curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
198 /* NOTE: use of CONNECTTIMEOUT without also
199 setting NOSIGNAL results in really weird
200 crashes on my system! */
201 curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
202 if (CURLE_OK != (errornum = curl_easy_perform (c))) 203 if (CURLE_OK != (errornum = curl_easy_perform (c)))
203 { 204 {
204 fprintf (stderr, 205 fprintf (stderr,
@@ -207,8 +208,8 @@ thread_gets (void *param)
207 curl_easy_cleanup (c); 208 curl_easy_cleanup (c);
208 return "curl error"; 209 return "curl error";
209 } 210 }
210 curl_easy_cleanup (c);
211 } 211 }
212 curl_easy_cleanup (c);
212 213
213 return NULL; 214 return NULL;
214} 215}
@@ -467,8 +468,9 @@ main (int argc, char *const *argv)
467 int port = 1100; 468 int port = 1100;
468 (void)argc; /* Unused. Silent compiler warning. */ 469 (void)argc; /* Unused. Silent compiler warning. */
469 470
470 oneone = (NULL != strrchr (argv[0], (int) '/')) ? 471 if (NULL == argv || 0 == argv[0])
471 (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; 472 return 99;
473 oneone = has_in_name (argv[0], "11");
472 if (oneone) 474 if (oneone)
473 port += 15; 475 port += 15;
474 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 476 if (0 != curl_global_init (CURL_GLOBAL_WIN32))