From 150965a9b3fb589a73c4fc9f6cdd636d3853e9d1 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 26 Oct 2023 10:58:40 +0300 Subject: [PATCH] gsocket: Fix detecting timeouts If she socket is dispatched at exactly the previously set ready time, it should already be considered to have timed out. This can easily happen in practice when using a low resolution timer. This fixes a test failure on GNU/Hurd, see https://gitlab.gnome.org/GNOME/glib/-/issues/3148 Signed-off-by: Sergey Bugaev --- gio/gsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gsocket.c b/gio/gsocket.c index 084a5e8e1..ee833a1a3 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -4060,7 +4060,7 @@ socket_source_dispatch (GSource *source, #endif timeout = g_source_get_ready_time (source); - if (timeout >= 0 && timeout < g_source_get_time (source) && + if (timeout >= 0 && timeout <= g_source_get_time (source) && !g_socket_is_closed (socket_source->socket)) { socket->priv->timed_out = TRUE;