X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fconnect.c;h=e12c049a11002e5a432f1758e1db7befe4ddf3ba;hp=8f32f9843bb74d7fc58c589b3ae449505dd4e7c6;hb=4a685764a845d5c74a76fcb49a4671f055b8d5f4;hpb=53427a9b76353246a4ddb0759d9bfdf952abe841 diff --git a/src/connect.c b/src/connect.c index 8f32f984..e12c049a 100644 --- a/src/connect.c +++ b/src/connect.c @@ -656,7 +656,14 @@ select_fd (int fd, double maxtime, int wait_for) tmout.tv_usec = 1000000 * (maxtime - (long) maxtime); do + { result = select (fd + 1, rd, wr, NULL, &tmout); +#ifdef WINDOWS + /* gnulib select() converts blocking sockets to nonblocking in windows. + wget uses blocking sockets so we must convert them back to blocking. */ + set_windows_fd_as_blocking_socket (fd); +#endif + } while (result < 0 && errno == EINTR); return result; @@ -678,6 +685,7 @@ test_socket_open (int sock) { fd_set check_set; struct timeval to; + int ret = 0; /* Check if we still have a valid (non-EOF) connection. From Andrew * Maholski's code in the Unix Socket FAQ. */ @@ -689,7 +697,15 @@ test_socket_open (int sock) to.tv_sec = 0; to.tv_usec = 1; - if (select (sock + 1, &check_set, NULL, NULL, &to) == 0) + ret = select (sock + 1, &check_set, NULL, NULL, &to); +#ifdef WINDOWS +/* gnulib select() converts blocking sockets to nonblocking in windows. +wget uses blocking sockets so we must convert them back to blocking +*/ + set_windows_fd_as_blocking_socket ( sock ); +#endif + + if ( !ret ) /* We got a timeout, it means we're still connected. */ return true; else