Commit a2521e3b authored by Youness Alaoui's avatar Youness Alaoui

Make the g_timeout_add use agent_timeout_add_with_context instead...

darcs-hash:20080422205137-4f0f6-8911d8cc165b0298a3e009834fe2dbed68cc1ca1.gz
parent 4c7b6ee9
......@@ -131,4 +131,6 @@ void agent_signal_initial_binding_request_received (NiceAgent *agent, Stream *st
guint64 agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandidate *remote);
guint agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSourceFunc function, gpointer data);
#endif /*_NICE_AGENT_PRIV_H */
......@@ -1853,3 +1853,21 @@ nice_agent_set_selected_pair (
g_mutex_unlock (agent->mutex);
return ret;
}
guint agent_timeout_add_with_context (NiceAgent *agent, guint interval,
GSourceFunc function, gpointer data)
{
GSource *source;
guint id;
g_return_val_if_fail (function != NULL, 0);
source = g_timeout_source_new (interval);
g_source_set_callback (source, function, data, NULL);
id = g_source_attach (source, agent->main_context);
g_source_unref (source);
return id;
}
......@@ -485,18 +485,12 @@ gboolean conn_check_schedule_next (NiceAgent *agent)
/* step: schedule timer if not running yet */
if (res && agent->conncheck_timer_id == 0) {
GSource *source = g_timeout_source_new (agent->timer_ta);
g_source_set_callback (source, priv_conn_check_tick, agent, NULL);
agent->conncheck_timer_id = g_source_attach (source, agent->main_context);
g_source_unref (source);
agent->conncheck_timer_id = agent_timeout_add_with_context (agent, agent->timer_ta, priv_conn_check_tick, agent);
}
/* step: also start the keepalive timer */
if (agent->keepalive_timer_id == 0) {
GSource *source = g_timeout_source_new (NICE_AGENT_TIMER_TR_DEFAULT);
g_source_set_callback (source, priv_conn_keepalive_tick, agent, NULL);
agent->keepalive_timer_id = g_source_attach (source, agent->main_context);
g_source_unref (source);
agent->keepalive_timer_id = agent_timeout_add_with_context (agent, NICE_AGENT_TIMER_TR_DEFAULT, priv_conn_keepalive_tick, agent);
}
}
......
......@@ -597,10 +597,7 @@ void discovery_schedule (NiceAgent *agent)
/* step: run first iteration immediately */
gboolean res = priv_discovery_tick_unlocked (agent);
if (res == TRUE) {
GSource *source = g_timeout_source_new (agent->timer_ta);
g_source_set_callback (source, priv_discovery_tick, agent, NULL);
agent->discovery_timer_id = g_source_attach (source, agent->main_context);
g_source_unref (source);
agent->discovery_timer_id = agent_timeout_add_with_context (agent, agent->timer_ta, priv_discovery_tick, agent);
}
}
}
......
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