Skip to content

Commit b7be1e4

Browse files
committed
Fix hang on Windows when multiple --client args are present
The Windows poll function does not clear revents field before it is populated. As a result, subsequent calls to poll using the same pollfd reference return with revents set even when there is nothing available to read. This later results in a hang in recv(). Signed-off-by: James Rizzo <[email protected]>
1 parent 96afc23 commit b7be1e4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

os/windows/posix.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,9 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout)
899899
FD_ZERO(&exceptfds);
900900

901901
for (i = 0; i < nfds; i++) {
902-
if (fds[i].fd == INVALID_SOCKET) {
903-
fds[i].revents = 0;
902+
fds[i].revents = 0;
903+
if (fds[i].fd == INVALID_SOCKET)
904904
continue;
905-
}
906905

907906
if (fds[i].events & POLLIN)
908907
FD_SET(fds[i].fd, &readfds);

0 commit comments

Comments
 (0)