From e134a4020885701b583b8af2e9d0414b090512f6 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Sun, 10 Sep 2006 19:01:04 +0000 Subject: Added select_test() function to allow selecting on no sockets on Winsock. --- tests/libtest/first.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/libtest/first.c') diff --git a/tests/libtest/first.c b/tests/libtest/first.c index a7f317355..fda1a7fb5 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -9,6 +9,21 @@ extern void curl_memlimit(int); /* test is provided in the test code file */ int test(char *url); +int select_test (int num_fds, fd_set *rd, fd_set *wr, fd_set *exc, + struct timeval *tv) +{ +#ifdef WIN32 + /* Winsock doesn't like no socket set in 'rd', 'wr' or 'exc'. This is + * case when 'num_fds <= 0. So sleep. + */ + if (num_fds <= 0) { + Sleep(1000*tv->tv_sec + tv->tv_usec/1000); + return 0; + } +#endif + return select(num_fds, rd, wr, exc, tv); +} + char *arg2=NULL; int main(int argc, char **argv) -- cgit v1.2.3