diff --git a/src/base/system.c b/src/base/system.c index 3a0c1319a..1718ffb7d 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -2232,8 +2232,11 @@ int net_socket_read_wait(NETSOCKET sock, int time) if(sock.web_ipv4sock >= 0) { int maxfd = websocket_fd_set(sock.web_ipv4sock, &readfds); - if (maxfd > sockid) + if(maxfd > sockid) + { sockid = maxfd; + FD_SET(sockid, &readfds); + } } #endif @@ -2245,7 +2248,10 @@ int net_socket_read_wait(NETSOCKET sock, int time) if(sock.ipv4sock >= 0 && FD_ISSET(sock.ipv4sock, &readfds)) return 1; - +#if defined(CONF_WEBSOCKETS) + if(sock.web_ipv4sock >= 0 && FD_ISSET(sockid, &readfds)) + return 1; +#endif if(sock.ipv6sock >= 0 && FD_ISSET(sock.ipv6sock, &readfds)) return 1; diff --git a/src/engine/shared/websockets.cpp b/src/engine/shared/websockets.cpp index fb26e7496..38d0d8d60 100644 --- a/src/engine/shared/websockets.cpp +++ b/src/engine/shared/websockets.cpp @@ -293,6 +293,7 @@ int websocket_fd_set(int socket, fd_set *set) lws_context *context = contexts[socket].context; if(context == NULL) return -1; + lws_service(context, -1); context_data *ctx_data = (context_data *)lws_context_user(context); int max = 0; for(auto const &x : ctx_data->port_map)