diff --git a/ixwebsocket/IXSocket.cpp b/ixwebsocket/IXSocket.cpp index e7be5e9e..cd6a2016 100644 --- a/ixwebsocket/IXSocket.cpp +++ b/ixwebsocket/IXSocket.cpp @@ -54,11 +54,12 @@ namespace ix // to ::poll does fix that. // // However poll isn't as portable as select and has bugs on Windows, so we - // should write a shim to fallback to select on those platforms. See + // have a shim to fallback to select on those platforms. See // https://github.com/mpv-player/mpv/pull/5203/files for such a select wrapper. // nfds_t nfds = 1; struct pollfd fds[2]; + memset(fds, 0 , sizeof(fds)); fds[0].fd = sockfd; fds[0].events = (readyToRead) ? POLLIN : POLLOUT; @@ -132,6 +133,10 @@ namespace ix } #endif } + else if (sockfd != -1 && (fds[0].revents & POLLERR || fds[0].revents & POLLHUP)) + { + pollResult = PollResultType::Error; + } return pollResult; }