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
471708b2
Commit
471708b2
authored
Jun 09, 2009
by
Youness Alaoui
Browse files
fix keepalive issue when there is network/cpu bottleneck
parent
0fe5f7c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
agent/agent-priv.h
View file @
471708b2
...
...
@@ -112,6 +112,7 @@ struct _NiceAgent
GStaticRecMutex
mutex
;
/* Mutex used for thread-safe lib */
NiceCompatibility
compatibility
;
/* property: Compatibility mode */
StunAgent
stun_agent
;
/* STUN agent */
gboolean
media_after_tick
;
/* Received media after keepalive tick */
#ifdef HAVE_GUPNP
GUPnPSimpleIgdThread
*
upnp
;
/* GUPnP Single IGD agent */
gboolean
upnp_enabled
;
/* whether UPnP discovery is enabled */
...
...
agent/agent.c
View file @
471708b2
...
...
@@ -537,6 +537,7 @@ nice_agent_init (NiceAgent *agent)
agent
->
conncheck_timer_source
=
NULL
;
agent
->
keepalive_timer_source
=
NULL
;
agent
->
refresh_list
=
NULL
;
agent
->
media_after_tick
=
FALSE
;
agent
->
compatibility
=
NICE_COMPATIBILITY_DRAFT19
;
...
...
@@ -1790,6 +1791,8 @@ _nice_agent_recv (
}
}
agent
->
media_after_tick
=
TRUE
;
if
(
stun_message_validate_buffer_length
((
uint8_t
*
)
buf
,
(
size_t
)
len
)
!=
len
)
/* If the retval is no 0, its not a valid stun packet, probably data */
return
len
;
...
...
agent/conncheck.c
View file @
471708b2
...
...
@@ -489,11 +489,25 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
stun_message_id
(
&
pair
->
keepalive
.
stun_message
,
id
);
stun_agent_forget_transaction
(
&
pair
->
keepalive
.
agent
->
stun_agent
,
id
);
nice_debug
(
"Agent %p : Keepalive conncheck timed out!! "
"peer probably lost connection"
,
pair
->
keepalive
.
agent
);
agent_signal_component_state_change
(
pair
->
keepalive
.
agent
,
pair
->
keepalive
.
stream_id
,
pair
->
keepalive
.
component_id
,
NICE_COMPONENT_STATE_FAILED
);
if
(
pair
->
keepalive
.
agent
->
media_after_tick
)
{
nice_debug
(
"Agent %p : Keepalive conncheck timed out!! "
"but media was received. Suspecting keepalive lost because of "
"network bottleneck"
,
pair
->
keepalive
.
agent
);
if
(
pair
->
keepalive
.
tick_source
)
{
g_source_destroy
(
pair
->
keepalive
.
tick_source
);
g_source_unref
(
pair
->
keepalive
.
tick_source
);
pair
->
keepalive
.
tick_source
=
NULL
;
}
pair
->
keepalive
.
stun_message
.
buffer
=
NULL
;
}
else
{
nice_debug
(
"Agent %p : Keepalive conncheck timed out!! "
"peer probably lost connection"
,
pair
->
keepalive
.
agent
);
agent_signal_component_state_change
(
pair
->
keepalive
.
agent
,
pair
->
keepalive
.
stream_id
,
pair
->
keepalive
.
component_id
,
NICE_COMPONENT_STATE_FAILED
);
}
break
;
}
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
...
...
@@ -589,6 +603,8 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
if
(
buf_len
>
0
)
{
stun_timer_start
(
&
p
->
keepalive
.
timer
);
agent
->
media_after_tick
=
FALSE
;
/* send the conncheck */
nice_socket_send
(
p
->
local
->
sockptr
,
&
p
->
remote
->
addr
,
buf_len
,
(
gchar
*
)
p
->
keepalive
.
stun_buffer
);
...
...
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