1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

avoid changing wrong revents if connection closed

As reported by Bruce Perens

http://ml.libwebsockets.org/pipermail/libwebsockets/2015-May/001814.html

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2015-10-15 08:34:21 +08:00
parent 1963c9aa7f
commit 940a75503c

View file

@ -400,9 +400,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
if (m == our_fd) {
/* it was the guy we came to service! */
timed_out = 1;
/* mark as handled */
if (pollfd)
pollfd->revents = 0;
/* he's gone, no need to mark as handled */
}
}
}
@ -619,7 +617,8 @@ close_and_handled:
lwsl_debug("Close and handled\n");
libwebsocket_close_and_free_session(context, wsi,
LWS_CLOSE_STATUS_NOSTATUS);
n = 1;
// pollfd points to something else after the close
return 1;
handled:
pollfd->revents = 0;