From 751e8f584cb5fd2d5b1643aed92822df23888bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Sun, 16 May 2021 12:35:23 +0200 Subject: agent: Consume data before removing disconnected socket This was caught by tests randomly failing (timing out). --- agent/agent.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agent/agent.c b/agent/agent.c index 8892cc3..a309f44 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -5827,8 +5827,9 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) return G_SOURCE_REMOVE; } - /* Remove disconnected sockets when we get a HUP */ - if (condition & G_IO_HUP) { + /* Remove disconnected sockets when we get a HUP and there's no more data to + * be read. */ + if (condition & G_IO_HUP && !(condition & G_IO_IN)) { nice_debug ("Agent %p: NiceSocket %p has received HUP", agent, socket_source->socket); if (component->selected_pair.local && -- cgit v1.2.1