diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/openssl/compat/poll_win.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/openssl/compat/poll_win.c b/apps/openssl/compat/poll_win.c index c518962..0d15522 100644 --- a/apps/openssl/compat/poll_win.c +++ b/apps/openssl/compat/poll_win.c | |||
| @@ -166,6 +166,7 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms) | |||
| 166 | * select machinery | 166 | * select machinery |
| 167 | */ | 167 | */ |
| 168 | fd_set rfds, wfds, efds; | 168 | fd_set rfds, wfds, efds; |
| 169 | fd_set rfds_in, wfds_in, efds_in; | ||
| 169 | int rc; | 170 | int rc; |
| 170 | int num_sockets; | 171 | int num_sockets; |
| 171 | 172 | ||
| @@ -250,12 +251,27 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms) | |||
| 250 | 251 | ||
| 251 | looptime_ms = (timeout_ms > 100 || timeout_ms == -1) ? 100 : timeout_ms; | 252 | looptime_ms = (timeout_ms > 100 || timeout_ms == -1) ? 100 : timeout_ms; |
| 252 | 253 | ||
| 254 | /* | ||
| 255 | * select() clears every descriptor that is not ready from the | ||
| 256 | * fd_sets, so a pass that times out leaves them empty. Keep a | ||
| 257 | * pristine copy and restore it before each select(), otherwise the | ||
| 258 | * next pass hands select() three empty sets and Windows fails it with | ||
| 259 | * WSAEINVAL instead of waiting out the remaining timeout. | ||
| 260 | */ | ||
| 261 | rfds_in = rfds; | ||
| 262 | wfds_in = wfds; | ||
| 263 | efds_in = efds; | ||
| 264 | |||
| 253 | do { | 265 | do { |
| 254 | TIMEVAL tv; | 266 | TIMEVAL tv; |
| 255 | tv.tv_sec = 0; | 267 | tv.tv_sec = 0; |
| 256 | tv.tv_usec = looptime_ms * 1000; | 268 | tv.tv_usec = looptime_ms * 1000; |
| 257 | int handle_signaled = 0; | 269 | int handle_signaled = 0; |
| 258 | 270 | ||
| 271 | rfds = rfds_in; | ||
| 272 | wfds = wfds_in; | ||
| 273 | efds = efds_in; | ||
| 274 | |||
| 259 | /* | 275 | /* |
| 260 | * Check if any file handles have signaled | 276 | * Check if any file handles have signaled |
| 261 | */ | 277 | */ |
