Commit 673e299f authored by Olivier Crete's avatar Olivier Crete

Add function specifically to hook up the io_src to a socket

darcs-hash:20080426001748-3e2dc-e243944bbd3ef193acdecbcf423856bcbc06ca94.gz
parent 51492d41
......@@ -1759,24 +1759,20 @@ nice_agent_g_source_cb (
return TRUE;
}
/**
* Attaches socket handles of 'stream' to the main eventloop
* context.
*
/*
* Attaches one socket handle to the main loop event context
*/
static gboolean priv_attach_stream_component (NiceAgent *agent,
static void
priv_attach_stream_component_socket (NiceAgent *agent,
Stream *stream,
Component *component,
NiceUDPSocket *udp_socket,
GMainContext *context)
{
GSList *i;
for (i = component->sockets; i; i = i->next) {
NiceUDPSocket *udp_socket = i->data;
GIOChannel *io;
GSource *source;
IOCtx *ctx;
GSList *modified_list;
io = g_io_channel_unix_new (udp_socket->fileno);
/* note: without G_IO_ERR the glib mainloop goes into
......@@ -1787,13 +1783,26 @@ static gboolean priv_attach_stream_component (NiceAgent *agent,
ctx, (GDestroyNotify) io_ctx_free);
g_debug ("Attach source %p (stream %u).", source, stream->id);
g_source_attach (source, context);
modified_list = g_slist_append (component->gsources, source);
if (!modified_list) {
g_source_destroy (source);
return FALSE;
}
component->gsources = modified_list;
}
component->gsources = g_slist_append (component->gsources, source);
}
/**
* Attaches socket handles of 'stream' to the main eventloop
* context.
*
*/
static gboolean
priv_attach_stream_component (NiceAgent *agent,
Stream *stream,
Component *component,
GMainContext *context)
{
GSList *i;
for (i = component->sockets; i; i = i->next)
priv_attach_stream_component_socket (agent, stream, component, i->data,
context);
return TRUE;
}
......
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