mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Fix I/O hang after received a large deflate frame
When a large deflate frame been received, WSAEnumNetworkEvents will indicate the socket is ready to read. And because the frame is compressed, it may not be consumed entirely(not all bytes ready to receive have been received), since WSAEnumNetworkEvents is edge triggered, and the socket read buffer never been drained, WSAEnumNetworkEvents will never indicate the socket is ready to read again. What here need is level trigger behavior, thus add additional recv with empty buffer to reset edge status.
This commit is contained in:
parent
d810379015
commit
5740356d9a
1 changed files with 3 additions and 1 deletions
|
@ -166,8 +166,10 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
|
|||
if (pfd->revents & LWS_POLLHUP)
|
||||
--eIdx;
|
||||
|
||||
if (pfd->revents)
|
||||
if (pfd->revents) {
|
||||
recv(pfd->fd, NULL, 0, 0);
|
||||
lws_service_fd_tsi(context, pfd, tsi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue