diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-08-18 12:00:29 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-08-18 12:48:46 +0300 |
commit | 0c3806b05804d668f3a88853f90e930bc180b10e (patch) | |
tree | 9f4e3bc80fe515ed2c91505e608fbc285ead9b7e /src/testcurl/test_post_loop.c | |
parent | ebd43f0373e3b62bf25213b5cd20a84e09c010e3 (diff) | |
download | libmicrohttpd-0c3806b05804d668f3a88853f90e930bc180b10e.tar.gz libmicrohttpd-0c3806b05804d668f3a88853f90e930bc180b10e.zip |
curl tests: updated select() error handling, file doxy
Tests reports now about unexpected errors from select() and
source code line number to simplify problematic position
locating.
Used much smaller timeout on W32 if system is doing some
sockets data processing in other threads.
Diffstat (limited to 'src/testcurl/test_post_loop.c')
-rw-r--r-- | src/testcurl/test_post_loop.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c index 0c8bf202..927c867b 100644 --- a/src/testcurl/test_post_loop.c +++ b/src/testcurl/test_post_loop.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 Christian Grothoff | 3 | Copyright (C) 2007 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 |
@@ -22,6 +23,7 @@ | |||
22 | * @file daemontest_post_loop.c | 23 | * @file daemontest_post_loop.c |
23 | * @brief Testcase for libmicrohttpd POST operations using URL-encoding | 24 | * @brief Testcase for libmicrohttpd POST operations using URL-encoding |
24 | * @author Christian Grothoff (inspired by bug report #1296) | 25 | * @author Christian Grothoff (inspired by bug report #1296) |
26 | * @author Karlson2k (Evgeny Grin) | ||
25 | */ | 27 | */ |
26 | 28 | ||
27 | #include "MHD_config.h" | 29 | #include "MHD_config.h" |
@@ -525,12 +527,25 @@ testExternalPost () | |||
525 | tv.tv_usec = (timeout % 1000) * 1000; | 527 | tv.tv_usec = (timeout % 1000) * 1000; |
526 | if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) | 528 | if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) |
527 | { | 529 | { |
528 | if (EINTR == errno) | 530 | #ifdef MHD_POSIX_SOCKETS |
529 | continue; | 531 | if (EINTR != errno) |
530 | fprintf (stderr, | 532 | { |
531 | "select failed: %s\n", | 533 | fprintf (stderr, "Unexpected select() error: %d. Line: %d\n", |
532 | strerror (errno)); | 534 | (int) errno, __LINE__); |
533 | break; | 535 | fflush (stderr); |
536 | exit (99); | ||
537 | } | ||
538 | #else | ||
539 | if ((WSAEINVAL != WSAGetLastError ()) || | ||
540 | (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) ) | ||
541 | { | ||
542 | fprintf (stderr, "Unexpected select() error: %d. Line: %d\n", | ||
543 | (int) WSAGetLastError (), __LINE__); | ||
544 | fflush (stderr); | ||
545 | exit (99); | ||
546 | } | ||
547 | Sleep (1); | ||
548 | #endif | ||
534 | } | 549 | } |
535 | while (CURLM_CALL_MULTI_PERFORM == | 550 | while (CURLM_CALL_MULTI_PERFORM == |
536 | curl_multi_perform (multi, &running)) | 551 | curl_multi_perform (multi, &running)) |