mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
handle HUP on any mode socket
I am using libwebsockets on Windows 7 in external poll mode. I am finding that if I present a socket fd on a normal HTTP connection (LWS_CONNMODE_HTTP_SERVING:) to libwebsocket_service_fd with just a HUP event, the event doesn't get handled but revents gets cleared indicating that the event has been handled. Should it be handled in the same way as LWS_CONNMODE_WS_SERVING? (Modified by AG to apply to all sockets) Signed-off-by: Andy Green <andy.green@linaro.org> Signed-off-by: Graham Newton <gnewton@peavey-eu.com>
This commit is contained in:
parent
9b8a29f8ca
commit
b1aa1d3389
1 changed files with 12 additions and 13 deletions
|
@ -986,6 +986,17 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
|
|||
|
||||
}
|
||||
|
||||
/* handle session socket closed */
|
||||
|
||||
if ((!(pollfd->revents & POLLIN)) &&
|
||||
(pollfd->revents & (POLLERR | POLLHUP))) {
|
||||
|
||||
lwsl_debug("Session Socket %p (fd=%d) dead\n",
|
||||
(void *)wsi, pollfd->fd);
|
||||
|
||||
goto close_and_handled;
|
||||
}
|
||||
|
||||
/* okay, what we came here to do... */
|
||||
|
||||
switch (wsi->mode) {
|
||||
|
@ -1002,17 +1013,6 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
|
|||
case LWS_CONNMODE_WS_SERVING:
|
||||
case LWS_CONNMODE_WS_CLIENT:
|
||||
|
||||
/* handle session socket closed */
|
||||
|
||||
if ((!(pollfd->revents & POLLIN)) &&
|
||||
(pollfd->revents & (POLLERR | POLLHUP))) {
|
||||
|
||||
lwsl_debug("Session Socket %p (fd=%d) dead\n",
|
||||
(void *)wsi, pollfd->fd);
|
||||
|
||||
goto close_and_handled;
|
||||
}
|
||||
|
||||
/* the guy requested a callback when it was OK to write */
|
||||
|
||||
if ((pollfd->revents & POLLOUT) &&
|
||||
|
@ -1020,8 +1020,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
|
|||
lws_handle_POLLOUT_event(context, wsi, pollfd) < 0) {
|
||||
lwsl_info("libwebsocket_service_fd: closing\n");
|
||||
goto close_and_handled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (wsi->u.ws.rxflow_buffer &&
|
||||
(wsi->u.ws.rxflow_change_to & LWS_RXFLOW_ALLOW)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue