From: Olivier Crête Date: Sat, 9 Aug 2014 20:18:33 +0000 (-0400) Subject: agent: Remove socket source on HUP X-Git-Tag: 0.1.8~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6fb00faadbe51d3ca4080cc48292950e7f7c7962;p=platform%2Fupstream%2Flibnice.git agent: Remove socket source on HUP --- diff --git a/agent/agent.c b/agent/agent.c index 86421d8..ba92496 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -4645,6 +4645,24 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) g_object_ref (agent); + /* Remove disconnected sockets when we get a HUP */ + if (condition & G_IO_HUP) { + nice_debug ("Agent %p: NiceSocket %p has received HUP", agent, + socket_source->socket); + if (component->selected_pair.local && + component->selected_pair.local->sockptr == socket_source->socket && + component->state == NICE_COMPONENT_STATE_READY) { + nice_debug ("Agent %p: Selected pair socket %p has HUP, declaring failed", + agent, socket_source->socket); + agent_signal_component_state_change (agent, + stream->id, component->id, NICE_COMPONENT_STATE_FAILED); + } + + component_detach_socket (component, socket_source->socket); + agent_unlock (); + return G_SOURCE_REMOVE; + } + has_io_callback = component_has_io_callback (component); /* Choose which receive buffer to use. If we’re reading for