mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #2859
2859: fix websockets behavior in net_socket_read_wait r=def- a=QingGo Co-authored-by: 清歌 <zyqingjohn@qq.com>
This commit is contained in:
commit
32b0e52ebb
|
@ -2232,8 +2232,11 @@ int net_socket_read_wait(NETSOCKET sock, int time)
|
||||||
if(sock.web_ipv4sock >= 0)
|
if(sock.web_ipv4sock >= 0)
|
||||||
{
|
{
|
||||||
int maxfd = websocket_fd_set(sock.web_ipv4sock, &readfds);
|
int maxfd = websocket_fd_set(sock.web_ipv4sock, &readfds);
|
||||||
if (maxfd > sockid)
|
if(maxfd > sockid)
|
||||||
|
{
|
||||||
sockid = maxfd;
|
sockid = maxfd;
|
||||||
|
FD_SET(sockid, &readfds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2245,7 +2248,10 @@ int net_socket_read_wait(NETSOCKET sock, int time)
|
||||||
|
|
||||||
if(sock.ipv4sock >= 0 && FD_ISSET(sock.ipv4sock, &readfds))
|
if(sock.ipv4sock >= 0 && FD_ISSET(sock.ipv4sock, &readfds))
|
||||||
return 1;
|
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))
|
if(sock.ipv6sock >= 0 && FD_ISSET(sock.ipv6sock, &readfds))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
@ -293,6 +293,7 @@ int websocket_fd_set(int socket, fd_set *set)
|
||||||
lws_context *context = contexts[socket].context;
|
lws_context *context = contexts[socket].context;
|
||||||
if(context == NULL)
|
if(context == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
lws_service(context, -1);
|
||||||
context_data *ctx_data = (context_data *)lws_context_user(context);
|
context_data *ctx_data = (context_data *)lws_context_user(context);
|
||||||
int max = 0;
|
int max = 0;
|
||||||
for(auto const &x : ctx_data->port_map)
|
for(auto const &x : ctx_data->port_map)
|
||||||
|
|
Loading…
Reference in a new issue