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 <bugaevc@gmail.com>
This commit is contained in:
Sergey Bugaev 2023-10-26 10:58:40 +03:00
parent 6b7b211338
commit 150965a9b3

View File

@ -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;