Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
libnice
libnice
Commits
675d1d20
Commit
675d1d20
authored
Sep 22, 2008
by
Sjoerd Simons
Browse files
Remove timeout sources from the right context
parent
f543d6b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
agent/agent-priv.h
View file @
675d1d20
...
...
@@ -86,9 +86,9 @@ struct _NiceAgent
NiceRNG
*
rng
;
/**< random number generator */
GSList
*
discovery_list
;
/**< list of CandidateDiscovery items */
guint
discovery_unsched_items
;
/**< number of discovery items unscheduled */
guint
discovery_timer_
id
;
/**< id
of discovery timer */
guint
conncheck_timer_
id
;
/**< id of discovery
timer */
guint
keepalive_timer_
id
;
/**< id
of keepalive timer */
GSource
*
discovery_timer_
source
;
/**< source
of discovery timer */
GSource
*
conncheck_timer_
source
;
/**< source of conncheck
timer */
GSource
*
keepalive_timer_
source
;
/**< source
of keepalive timer */
guint64
tie_breaker
;
/**< tie breaker (ICE sect 5.2
"Determining Role" ID-19) */
GStaticRecMutex
mutex
;
/* Mutex used for thread-safe lib */
...
...
@@ -133,7 +133,7 @@ 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
);
GSource
*
agent_timeout_add_with_context
(
NiceAgent
*
agent
,
guint
interval
,
GSourceFunc
function
,
gpointer
data
);
void
priv_attach_stream_component_socket
(
NiceAgent
*
agent
,
Stream
*
stream
,
...
...
agent/agent.c
View file @
675d1d20
...
...
@@ -367,9 +367,9 @@ nice_agent_init (NiceAgent *agent)
agent
->
discovery_list
=
NULL
;
agent
->
discovery_unsched_items
=
0
;
agent
->
discovery_timer_
id
=
0
;
agent
->
conncheck_timer_
id
=
0
;
agent
->
keepalive_timer_
id
=
0
;
agent
->
discovery_timer_
source
=
NULL
;
agent
->
conncheck_timer_
source
=
NULL
;
agent
->
keepalive_timer_
source
=
NULL
;
agent
->
compatibility
=
NICE_COMPATIBILITY_DRAFT19
;
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
...
...
@@ -909,9 +909,10 @@ nice_agent_gather_candidates (
static
void
priv_remove_keepalive_timer
(
NiceAgent
*
agent
)
{
if
(
agent
->
keepalive_timer_id
)
{
g_source_remove
(
agent
->
keepalive_timer_id
),
agent
->
keepalive_timer_id
=
0
;
if
(
agent
->
keepalive_timer_source
!=
NULL
)
{
g_source_destroy
(
agent
->
keepalive_timer_source
);
g_source_unref
(
agent
->
keepalive_timer_source
);
agent
->
keepalive_timer_source
=
NULL
;
}
}
...
...
@@ -2042,7 +2043,7 @@ nice_agent_set_selected_pair (
}
guint
agent_timeout_add_with_context
(
NiceAgent
*
agent
,
guint
interval
,
GSource
*
agent_timeout_add_with_context
(
NiceAgent
*
agent
,
guint
interval
,
GSourceFunc
function
,
gpointer
data
)
{
GSource
*
source
;
...
...
@@ -2054,9 +2055,8 @@ guint agent_timeout_add_with_context (NiceAgent *agent, guint interval,
g_source_set_callback
(
source
,
function
,
data
,
NULL
);
id
=
g_source_attach
(
source
,
agent
->
main_context
);
g_source_unref
(
source
);
return
id
;
return
source
;
}
...
...
agent/conncheck.c
View file @
675d1d20
...
...
@@ -537,13 +537,13 @@ gboolean conn_check_schedule_next (NiceAgent *agent)
nice_debug
(
"Agent %p : priv_conn_check_tick_unlocked returned %d"
,
agent
,
res
);
/* step: schedule timer if not running yet */
if
(
res
&&
agent
->
conncheck_timer_
id
==
0
)
{
agent
->
conncheck_timer_
id
=
agent_timeout_add_with_context
(
agent
,
agent
->
timer_ta
,
priv_conn_check_tick
,
agent
);
if
(
res
&&
agent
->
conncheck_timer_
source
==
NULL
)
{
agent
->
conncheck_timer_
source
=
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
)
{
agent
->
keepalive_timer_
id
=
agent_timeout_add_with_context
(
agent
,
NICE_AGENT_TIMER_TR_DEFAULT
,
priv_conn_keepalive_tick
,
agent
);
if
(
agent
->
keepalive_timer_
source
==
NULL
)
{
agent
->
keepalive_timer_
source
=
agent_timeout_add_with_context
(
agent
,
NICE_AGENT_TIMER_TR_DEFAULT
,
priv_conn_keepalive_tick
,
agent
);
}
}
...
...
@@ -951,9 +951,10 @@ void conn_check_free (NiceAgent *agent)
}
}
if
(
agent
->
conncheck_timer_id
)
{
g_source_remove
(
agent
->
conncheck_timer_id
),
agent
->
conncheck_timer_id
=
0
;
if
(
agent
->
conncheck_timer_source
!=
NULL
)
{
g_source_destroy
(
agent
->
conncheck_timer_source
);
g_source_unref
(
agent
->
conncheck_timer_source
);
agent
->
conncheck_timer_source
=
NULL
;
}
}
...
...
agent/discovery.c
View file @
675d1d20
...
...
@@ -117,9 +117,11 @@ void discovery_free (NiceAgent *agent)
agent
->
discovery_unsched_items
=
0
;
}
if
(
agent
->
discovery_timer_id
)
g_source_remove
(
agent
->
discovery_timer_id
),
agent
->
discovery_timer_id
=
0
;
if
(
agent
->
discovery_timer_source
!=
NULL
)
{
g_source_destroy
(
agent
->
discovery_timer_source
);
g_source_unref
(
agent
->
discovery_timer_source
);
agent
->
discovery_timer_source
=
NULL
;
}
}
/**
...
...
@@ -843,11 +845,11 @@ void discovery_schedule (NiceAgent *agent)
if
(
agent
->
discovery_unsched_items
>
0
)
{
if
(
agent
->
discovery_timer_
id
==
0
)
{
if
(
agent
->
discovery_timer_
source
==
NULL
)
{
/* step: run first iteration immediately */
gboolean
res
=
priv_discovery_tick_unlocked
(
agent
);
if
(
res
==
TRUE
)
{
agent
->
discovery_timer_
id
=
agent_timeout_add_with_context
(
agent
,
agent
->
timer_ta
,
priv_discovery_tick
,
agent
);
agent
->
discovery_timer_
source
=
agent_timeout_add_with_context
(
agent
,
agent
->
timer_ta
,
priv_discovery_tick
,
agent
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment