mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
close connection if socket recv() fails.
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>
This commit is contained in:
parent
f803c0d9df
commit
c04c193dc3
1 changed files with 4 additions and 1 deletions
|
@ -1964,7 +1964,10 @@ bail3:
|
|||
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,
|
||||
|
|
Loading…
Add table
Reference in a new issue