This prevents a problem observed on Windows whereby a client that
disconnects before fully establishing the WebSocket would cause the
server to use 100% CPU since recv() would continually return -1 for that
socket.
Signed-off-by: Nick Dowell <nick@nickdowell.com>
if (eff_buf.token_len < 0) {
fprintf(stderr, "Socket read returned %d\n",
eff_buf.token_len);
- break;
+ if (errno != EINTR)
+ libwebsocket_close_and_free_session(context, wsi,
+ LWS_CLOSE_STATUS_NOSTATUS);
+ return 1;
}
if (!eff_buf.token_len) {
libwebsocket_close_and_free_session(context, wsi,