diff options
author | Ole André Vadla Ravnås <oleavr@gmail.com> | 2021-05-16 12:35:23 +0200 |
---|---|---|
committer | Olivier Crête <olivier.crete@ocrete.ca> | 2021-11-22 21:53:08 +0000 |
commit | 751e8f584cb5fd2d5b1643aed92822df23888bd7 (patch) | |
tree | f6c96d6f620cbc5b2a262536c13a45b48f4d075d | |
parent | b10eb7aefb62bd0f527035bc5c6b6381416f3a9e (diff) | |
download | libnice-751e8f584cb5fd2d5b1643aed92822df23888bd7.tar.gz |
agent: Consume data before removing disconnected socket
This was caught by tests randomly failing (timing out).
-rw-r--r-- | agent/agent.c | 5 |
1 files 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 && |