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