aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_add_conn.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-08-18 12:00:29 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-08-18 12:48:46 +0300
commit0c3806b05804d668f3a88853f90e930bc180b10e (patch)
tree9f4e3bc80fe515ed2c91505e608fbc285ead9b7e /src/testcurl/test_add_conn.c
parentebd43f0373e3b62bf25213b5cd20a84e09c010e3 (diff)
downloadlibmicrohttpd-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_add_conn.c')
-rw-r--r--src/testcurl/test_add_conn.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c
index d122a50e..04def886 100644
--- a/src/testcurl/test_add_conn.c
+++ b/src/testcurl/test_add_conn.c
@@ -1,7 +1,8 @@
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) 2020 Karlson2k (Evgeny Grin) - large rework, multithreading. 4 Copyright (C) 2014-2020 Evgeny Grin (Karlson2k) - large rework,
5 multithreading.
5 6
6 libmicrohttpd is free software; you can redistribute it and/or modify 7 libmicrohttpd is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published 8 it under the terms of the GNU General Public License as published
@@ -922,14 +923,22 @@ testExternalGet (void)
922 { 923 {
923#ifdef MHD_POSIX_SOCKETS 924#ifdef MHD_POSIX_SOCKETS
924 if (EINTR != errno) 925 if (EINTR != errno)
925 externalErrorExitDesc ("select() failed"); 926 {
927 fprintf (stderr, "Unexpected select() error: %d. Line: %d\n",
928 (int) errno, __LINE__);
929 fflush (stderr);
930 exit (99);
931 }
926#else 932#else
927 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 != 933 if ((WSAEINVAL != WSAGetLastError ()) ||
928 ws. 934 (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) )
929 fd_count) 935 {
930 || (0 != es.fd_count) ) 936 fprintf (stderr, "Unexpected select() error: %d. Line: %d\n",
931 externalErrorExitDesc ("select() failed"); 937 (int) WSAGetLastError (), __LINE__);
932 Sleep (1000); 938 fflush (stderr);
939 exit (99);
940 }
941 Sleep (1);
933#endif 942#endif
934 } 943 }
935 if (FD_ISSET (aParam.lstn_sk, &rs)) 944 if (FD_ISSET (aParam.lstn_sk, &rs))