diff options
Diffstat (limited to 'src/testcurl/test_get_close_keep_alive.c')
-rw-r--r-- | src/testcurl/test_get_close_keep_alive.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/testcurl/test_get_close_keep_alive.c b/src/testcurl/test_get_close_keep_alive.c index 1dbf7cc4..faa0f202 100644 --- a/src/testcurl/test_get_close_keep_alive.c +++ b/src/testcurl/test_get_close_keep_alive.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | Copyright (C) 2017-2021 Karlson2k (Evgeny Grin) | 3 | Copyright (C) 2014-2021 Evgeny Grin (Karlson2k) |
4 | Copyright (C) 2007, 2009, 2011 Christian Grothoff | 4 | Copyright (C) 2007, 2009, 2011 Christian Grothoff |
5 | 5 | ||
6 | libmicrohttpd is free software; you can redistribute it and/or modify | 6 | libmicrohttpd is free software; you can redistribute it and/or modify |
@@ -113,7 +113,7 @@ _externalErrorExit_func (const char *errDesc, const char *funcName, int lineNum) | |||
113 | fprintf (stderr, "WSAGetLastError() value: %d\n", (int) WSAGetLastError ()); | 113 | fprintf (stderr, "WSAGetLastError() value: %d\n", (int) WSAGetLastError ()); |
114 | #endif /* MHD_WINSOCK_SOCKETS */ | 114 | #endif /* MHD_WINSOCK_SOCKETS */ |
115 | fflush (stderr); | 115 | fflush (stderr); |
116 | _exit (99); | 116 | exit (99); |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
@@ -137,7 +137,7 @@ _libcurlErrorExit_func (const char *errDesc, const char *funcName, int lineNum) | |||
137 | fprintf (stderr, "Last libcurl error details: %s\n", libcurl_errbuf); | 137 | fprintf (stderr, "Last libcurl error details: %s\n", libcurl_errbuf); |
138 | 138 | ||
139 | fflush (stderr); | 139 | fflush (stderr); |
140 | _exit (99); | 140 | exit (99); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
@@ -274,7 +274,7 @@ log_cb (void *cls, | |||
274 | fprintf (stderr, | 274 | fprintf (stderr, |
275 | "Wrong URI: `%s', line: %d\n", | 275 | "Wrong URI: `%s', line: %d\n", |
276 | uri, __LINE__); | 276 | uri, __LINE__); |
277 | _exit (22); | 277 | exit (22); |
278 | } | 278 | } |
279 | return NULL; | 279 | return NULL; |
280 | } | 280 | } |
@@ -314,7 +314,7 @@ ahc_echo (void *cls, | |||
314 | if (NULL == response) | 314 | if (NULL == response) |
315 | { | 315 | { |
316 | fprintf (stderr, "Failed to create response. Line: %d\n", __LINE__); | 316 | fprintf (stderr, "Failed to create response. Line: %d\n", __LINE__); |
317 | _exit (19); | 317 | exit (19); |
318 | } | 318 | } |
319 | if (add_mhd_close) | 319 | if (add_mhd_close) |
320 | { | 320 | { |
@@ -323,7 +323,7 @@ ahc_echo (void *cls, | |||
323 | HDR_CONN_CLOSE_VALUE)) | 323 | HDR_CONN_CLOSE_VALUE)) |
324 | { | 324 | { |
325 | fprintf (stderr, "Failed to add header. Line: %d\n", __LINE__); | 325 | fprintf (stderr, "Failed to add header. Line: %d\n", __LINE__); |
326 | _exit (19); | 326 | exit (19); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | ret = MHD_queue_response (connection, | 329 | ret = MHD_queue_response (connection, |
@@ -333,7 +333,7 @@ ahc_echo (void *cls, | |||
333 | if (ret == MHD_NO) | 333 | if (ret == MHD_NO) |
334 | { | 334 | { |
335 | fprintf (stderr, "Failed to queue response. Line: %d\n", __LINE__); | 335 | fprintf (stderr, "Failed to queue response. Line: %d\n", __LINE__); |
336 | _exit (19); | 336 | exit (19); |
337 | } | 337 | } |
338 | return ret; | 338 | return ret; |
339 | } | 339 | } |
@@ -523,11 +523,11 @@ performQueryExternal (struct MHD_Daemon *d, CURL *c) | |||
523 | if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxMhdSk)) | 523 | if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxMhdSk)) |
524 | { | 524 | { |
525 | fprintf (stderr, "MHD_get_fdset() failed. Line: %d\n", __LINE__); | 525 | fprintf (stderr, "MHD_get_fdset() failed. Line: %d\n", __LINE__); |
526 | _exit (11); | 526 | exit (11); |
527 | break; | 527 | break; |
528 | } | 528 | } |
529 | tv.tv_sec = 0; | 529 | tv.tv_sec = 0; |
530 | tv.tv_usec = 10000; | 530 | tv.tv_usec = 1000; |
531 | #ifdef MHD_POSIX_SOCKETS | 531 | #ifdef MHD_POSIX_SOCKETS |
532 | if (maxMhdSk > maxCurlSk) | 532 | if (maxMhdSk > maxCurlSk) |
533 | maxCurlSk = maxMhdSk; | 533 | maxCurlSk = maxMhdSk; |
@@ -536,18 +536,28 @@ performQueryExternal (struct MHD_Daemon *d, CURL *c) | |||
536 | { | 536 | { |
537 | #ifdef MHD_POSIX_SOCKETS | 537 | #ifdef MHD_POSIX_SOCKETS |
538 | if (EINTR != errno) | 538 | if (EINTR != errno) |
539 | externalErrorExitDesc ("select() failed"); | 539 | { |
540 | fprintf (stderr, "Unexpected select() error: %d. Line: %d\n", | ||
541 | (int) errno, __LINE__); | ||
542 | fflush (stderr); | ||
543 | exit (99); | ||
544 | } | ||
540 | #else | 545 | #else |
541 | if ((WSAEINVAL != WSAGetLastError ()) || | 546 | if ((WSAEINVAL != WSAGetLastError ()) || |
542 | (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count)) | 547 | (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) ) |
543 | externalErrorExitDesc ("select() failed"); | 548 | { |
544 | Sleep (10); | 549 | fprintf (stderr, "Unexpected select() error: %d. Line: %d\n", |
550 | (int) WSAGetLastError (), __LINE__); | ||
551 | fflush (stderr); | ||
552 | exit (99); | ||
553 | } | ||
554 | Sleep (1); | ||
545 | #endif | 555 | #endif |
546 | } | 556 | } |
547 | if (MHD_YES != MHD_run_from_select (d, &rs, &ws, &es)) | 557 | if (MHD_YES != MHD_run_from_select (d, &rs, &ws, &es)) |
548 | { | 558 | { |
549 | fprintf (stderr, "MHD_run_from_select() failed. Line: %d\n", __LINE__); | 559 | fprintf (stderr, "MHD_run_from_select() failed. Line: %d\n", __LINE__); |
550 | _exit (11); | 560 | exit (11); |
551 | } | 561 | } |
552 | } | 562 | } |
553 | 563 | ||
@@ -706,7 +716,7 @@ doCurlQueryInThread (struct MHD_Daemon *d, | |||
706 | fprintf (stderr, "MHD has wrong number of active connection (%u) " | 716 | fprintf (stderr, "MHD has wrong number of active connection (%u) " |
707 | "after response has been sent. Line: %d\n", num_conn, | 717 | "after response has been sent. Line: %d\n", num_conn, |
708 | __LINE__); | 718 | __LINE__); |
709 | _exit (23); | 719 | exit (23); |
710 | } | 720 | } |
711 | } | 721 | } |
712 | } | 722 | } |