From a36ffe678f891d6c24e1e6bcfbcd0b641d9d4c1a Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Tue, 14 Nov 2023 22:07:52 -0600 Subject: [PATCH] bugfix: possible infinite loops in tcp server --- core/net/tcp.onyx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/net/tcp.onyx b/core/net/tcp.onyx index 967c8487..9b451e99 100644 --- a/core/net/tcp.onyx +++ b/core/net/tcp.onyx @@ -239,6 +239,18 @@ tcp_server_pulse :: (use server: &TCP_Server) -> bool { status_buffer: [1] Socket_Poll_Status; socket_poll_all(.[&socket], status_buffer, -1); return server.alive; + + } else do for clients { + // If we have some clients, make sure their sockets are still alive. + // There were issues detecting this in the poll() function so we do + // do it explictly here. + + if it == null do continue; + if it.state != .Alive do continue; + + if !it.socket->is_alive() { + tcp_server_kill_client(server, it); + } } clients_with_messages := wait_to_get_client_messages(server); -- 2.25.1