Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
923d3610
Commit
923d3610
authored
Mar 04, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match the response correctly and stop the retransmissions when we get the response
parent
be909aeb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
3 deletions
+39
-3
agent/conncheck.c
agent/conncheck.c
+39
-3
No files found.
agent/conncheck.c
View file @
923d3610
...
@@ -463,8 +463,11 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
...
@@ -463,8 +463,11 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
switch
(
stun_timer_refresh
(
&
pair
->
keepalive
.
timer
))
{
switch
(
stun_timer_refresh
(
&
pair
->
keepalive
.
timer
))
{
case
STUN_USAGE_TIMER_RETURN_TIMEOUT
:
case
STUN_USAGE_TIMER_RETURN_TIMEOUT
:
/* Time out */
/* Time out */
nice_debug
(
"Agent %p : Keepalive conncheck Timed out!! "
nice_debug
(
"Agent %p : Keepalive conncheck timed out!! "
"peer probably lost connection"
);
"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
;
break
;
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
/* Retransmit */
/* Retransmit */
...
@@ -472,7 +475,8 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
...
@@ -472,7 +475,8 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
stun_message_length
(
&
pair
->
keepalive
.
stun_message
),
stun_message_length
(
&
pair
->
keepalive
.
stun_message
),
(
gchar
*
)
pair
->
keepalive
.
stun_buffer
);
(
gchar
*
)
pair
->
keepalive
.
stun_buffer
);
nice_debug
(
"Agent %p : Retransmitting keepalive conncheck"
);
nice_debug
(
"Agent %p : Retransmitting keepalive conncheck"
,
pair
->
keepalive
.
agent
);
pair
->
keepalive
.
tick_source
=
pair
->
keepalive
.
tick_source
=
agent_timeout_add_with_context
(
pair
->
keepalive
.
agent
,
agent_timeout_add_with_context
(
pair
->
keepalive
.
agent
,
stun_timer_remainder
(
&
pair
->
keepalive
.
timer
),
stun_timer_remainder
(
&
pair
->
keepalive
.
timer
),
...
@@ -2257,6 +2261,33 @@ static gboolean priv_map_reply_to_relay_refresh (NiceAgent *agent, StunMessage *
...
@@ -2257,6 +2261,33 @@ static gboolean priv_map_reply_to_relay_refresh (NiceAgent *agent, StunMessage *
}
}
static
gboolean
priv_map_reply_to_keepalive_conncheck
(
NiceAgent
*
agent
,
Component
*
component
,
StunMessage
*
resp
)
{
StunTransactionId
conncheck_id
;
StunTransactionId
response_id
;
stun_message_id
(
resp
,
response_id
);
if
(
component
->
selected_pair
.
keepalive
.
stun_message
.
buffer
)
{
stun_message_id
(
&
component
->
selected_pair
.
keepalive
.
stun_message
,
conncheck_id
);
if
(
memcmp
(
conncheck_id
,
response_id
,
sizeof
(
StunTransactionId
))
==
0
)
{
nice_debug
(
"Agent %p : Keepalive for selected pair received."
,
agent
);
if
(
component
->
selected_pair
.
keepalive
.
tick_source
)
{
g_source_destroy
(
component
->
selected_pair
.
keepalive
.
tick_source
);
g_source_unref
(
component
->
selected_pair
.
keepalive
.
tick_source
);
component
->
selected_pair
.
keepalive
.
tick_source
=
NULL
;
}
component
->
selected_pair
.
keepalive
.
stun_message
.
buffer
=
NULL
;
return
TRUE
;
}
}
return
FALSE
;
}
typedef
struct
{
typedef
struct
{
NiceAgent
*
agent
;
NiceAgent
*
agent
;
Stream
*
stream
;
Stream
*
stream
;
...
@@ -2637,6 +2668,11 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
...
@@ -2637,6 +2668,11 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if
(
trans_found
!=
TRUE
)
if
(
trans_found
!=
TRUE
)
trans_found
=
priv_map_reply_to_relay_refresh
(
agent
,
&
req
);
trans_found
=
priv_map_reply_to_relay_refresh
(
agent
,
&
req
);
/* step: let's try to match the response to an existing keepalive conncheck */
if
(
trans_found
!=
TRUE
)
trans_found
=
priv_map_reply_to_keepalive_conncheck
(
agent
,
component
,
&
req
);
if
(
trans_found
!=
TRUE
)
if
(
trans_found
!=
TRUE
)
nice_debug
(
"Agent %p : Unable to match to an existing transaction, "
nice_debug
(
"Agent %p : Unable to match to an existing transaction, "
"probably a keepalive."
,
agent
);
"probably a keepalive."
,
agent
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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