diff options
Diffstat (limited to 'src/testcurl/perf_get_concurrent.c')
-rw-r--r-- | src/testcurl/perf_get_concurrent.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c index 0cfd1366..76bb42f9 100644 --- a/src/testcurl/perf_get_concurrent.c +++ b/src/testcurl/perf_get_concurrent.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | Copyright (C) 2007, 2009, 2011 Christian Grothoff | 3 | Copyright (C) 2007, 2009, 2011 Christian Grothoff |
4 | Copyright (C) 2014-2021 Evgeny Grin (Karlson2k) | ||
4 | 5 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 6 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 7 | it under the terms of the GNU General Public License as published |
@@ -30,6 +31,7 @@ | |||
30 | * (since MHD is actually better); only the relative | 31 | * (since MHD is actually better); only the relative |
31 | * scores between MHD versions are meaningful. | 32 | * scores between MHD versions are meaningful. |
32 | * @author Christian Grothoff | 33 | * @author Christian Grothoff |
34 | * @author Karlson2k (Evgeny Grin) | ||
33 | */ | 35 | */ |
34 | 36 | ||
35 | #include "MHD_config.h" | 37 | #include "MHD_config.h" |
@@ -203,7 +205,7 @@ thread_gets (void *param) | |||
203 | setting NOSIGNAL results in really weird | 205 | setting NOSIGNAL results in really weird |
204 | crashes on my system! */ | 206 | crashes on my system! */ |
205 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); | 207 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); |
206 | for (i = 0; i<ROUNDS; i++) | 208 | for (i = 0; i < ROUNDS; i++) |
207 | { | 209 | { |
208 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 210 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
209 | { | 211 | { |
@@ -233,7 +235,7 @@ do_gets (void *param) | |||
233 | sizeof (url), | 235 | sizeof (url), |
234 | "http://127.0.0.1:%d/hello_world", | 236 | "http://127.0.0.1:%d/hello_world", |
235 | port); | 237 | port); |
236 | for (j = 0; j<PAR; j++) | 238 | for (j = 0; j < PAR; j++) |
237 | { | 239 | { |
238 | if (0 != pthread_create (&par[j], NULL, &thread_gets, (void*) url)) | 240 | if (0 != pthread_create (&par[j], NULL, &thread_gets, (void*) url)) |
239 | { | 241 | { |
@@ -242,7 +244,7 @@ do_gets (void *param) | |||
242 | return "pthread_create error"; | 244 | return "pthread_create error"; |
243 | } | 245 | } |
244 | } | 246 | } |
245 | for (j = 0; j<PAR; j++) | 247 | for (j = 0; j < PAR; j++) |
246 | { | 248 | { |
247 | char *ret_val; | 249 | char *ret_val; |
248 | if ((0 != pthread_join (par[j], (void**) &ret_val)) || | 250 | if ((0 != pthread_join (par[j], (void**) &ret_val)) || |
@@ -461,23 +463,26 @@ testExternalGet (int port) | |||
461 | if (-1 == select (max + 1, &rs, &ws, &es, &tv)) | 463 | if (-1 == select (max + 1, &rs, &ws, &es, &tv)) |
462 | { | 464 | { |
463 | #ifdef MHD_POSIX_SOCKETS | 465 | #ifdef MHD_POSIX_SOCKETS |
464 | if (EINTR == errno) | 466 | if (EINTR != errno) |
465 | continue; | ||
466 | fprintf (stderr, | ||
467 | "select failed: %s\n", | ||
468 | strerror (errno)); | ||
469 | #else | ||
470 | if ((WSAEINVAL == WSAGetLastError ()) && (0 == rs.fd_count) && (0 == | ||
471 | ws. | ||
472 | fd_count) | ||
473 | && (0 == es.fd_count) ) | ||
474 | { | 467 | { |
475 | Sleep (1000); | 468 | fprintf (stderr, "Unexpected select() error: %d. Line: %d\n", |
476 | continue; | 469 | (int) errno, __LINE__); |
470 | fflush (stderr); | ||
471 | exit (99); | ||
477 | } | 472 | } |
478 | #endif | ||
479 | ret |= 1024; | 473 | ret |= 1024; |
480 | break; | 474 | break; |
475 | #else | ||
476 | if ((WSAEINVAL != WSAGetLastError ()) || | ||
477 | (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) ) | ||
478 | { | ||
479 | fprintf (stderr, "Unexpected select() error: %d. Line: %d\n", | ||
480 | (int) WSAGetLastError (), __LINE__); | ||
481 | fflush (stderr); | ||
482 | exit (99); | ||
483 | } | ||
484 | Sleep (1); | ||
485 | #endif | ||
481 | } | 486 | } |
482 | MHD_run_from_select (d, &rs, &ws, &es); | 487 | MHD_run_from_select (d, &rs, &ws, &es); |
483 | } | 488 | } |