mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fix websockets behavior in net_socket_read_wait
This commit is contained in:
parent
4317cb7af8
commit
059a2a0a35
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue