Commit 2bb0fc58 authored by Olivier Crête's avatar Olivier Crête

component: Close HUP'd sockets on dispatch

Instead of dispatching an error, just close all
the sockets.
parent b2611934
......@@ -1186,6 +1186,43 @@ component_source_dispatch (GSource *source, GSourceFunc callback,
ComponentSource *component_source = (ComponentSource *) source;
GDatagramBasedSourceFunc func = (GDatagramBasedSourceFunc) callback;
if (component_source->current_condition & (G_IO_ERR | G_IO_HUP)) {
GSList *i;
gboolean one_good = FALSE;
NiceAgent *agent = NULL;
Component *component = NULL;
agent_lock ();
again:
for (i = component_source->socket_sources; i; i = i->next) {
ChildSocketSource *child_socket_source = i->data;
if (child_socket_source->parent_socket_source->last_condition & (G_IO_ERR | G_IO_HUP)) {
if (agent == NULL) {
g_weak_ref_get (&component_source->agent_ref);
if (agent == NULL ||
!agent_find_component (agent, component_source->stream_id,
component_source->component_id, NULL, &component)) {
component_source->current_condition |= G_IO_HUP;
component_source->current_condition &=
~(G_IO_IN | G_IO_ERR | G_IO_PRI);
goto gone;
}
}
component_remove_socket (component, child_socket_source->socket);
goto again;
} else {
one_good = TRUE;
}
}
gone:
if (one_good)
component_source->current_condition &= ~(G_IO_HUP | G_IO_ERR);
if (agent)
g_clear_object (&agent);
agent_unlock ();
}
return func (component_source->datagram_based,
component_source->current_condition, user_data);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment