[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Remove set_windows_fd_as_blocking_socket()?
From: |
Gisle Vanem |
Subject: |
Re: [Bug-wget] Remove set_windows_fd_as_blocking_socket()? |
Date: |
Wed, 6 Aug 2014 20:47:12 +0200 |
"Ray Satiro" <address@hidden> wrote:
How many times is select called?
AFAICR that would be 277.000 times too. I.e. only 1 loop through
set_windows_fd_as_blocking_socket().
The function should only be called on a non-blocking socket to set it
blocking. It was needed because gnulib's select called WSAEventSelect()
which turns blocking sockets into non-blocking. After every select call
in wget the socket had to be turned back into blocking because wget used
blocking sockets.
True. MSDN [1] has this to say:
The WSAEventSelect function automatically sets socket s to nonblocking
mode, regardless of the value of lNetworkEvents. ...
But:
To set socket s back to blocking mode, it is first necessary to clear the event
record associated with socket s via a call to WSAEventSelect with lNetworkEvents
set to zero and the hEventObject parameter set to NULL. You can then call
ioctlsocketor WSAIoctl to set the socket back to blocking mode.
I.e.: WSAEventSelect(NULL,0). So I fail to see why the current
wait-loop with is needed or even better. How can a 'ioctl (fd, FIONBIO, &zero)'
be in-progress?
Assuming both those things are still true and the wget
team is not going back to MS select() then the code is needed.
Going back MS' select() seems impossible since gnulib is required for
lots of other stuff.
[1]
http://msdn.microsoft.com/en-us/library/windows/desktop/ms741576(v=vs.85).aspx
--gv