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
f46eba9f
Commit
f46eba9f
authored
Jan 30, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port libnice agent to the StunUsageTimerReturn API
parent
03dce9b3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
20 deletions
+21
-20
agent/conncheck.c
agent/conncheck.c
+11
-10
agent/discovery.c
agent/discovery.c
+6
-5
socket/turn.c
socket/turn.c
+4
-5
No files found.
agent/conncheck.c
View file @
f46eba9f
...
@@ -257,9 +257,8 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
...
@@ -257,9 +257,8 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
p
->
state
=
NICE_CHECK_FAILED
;
p
->
state
=
NICE_CHECK_FAILED
;
nice_debug
(
"Agent %p : pair %p state FAILED"
,
agent
,
p
);
nice_debug
(
"Agent %p : pair %p state FAILED"
,
agent
,
p
);
}
else
if
(
priv_timer_expired
(
&
p
->
next_tick
,
now
))
{
}
else
if
(
priv_timer_expired
(
&
p
->
next_tick
,
now
))
{
int
timeout
=
stun_timer_refresh
(
&
p
->
timer
);
switch
(
stun_timer_refresh
(
&
p
->
timer
))
{
switch
(
timeout
)
{
case
STUN_USAGE_TIMER_RETURN_TIMEOUT
:
case
-
1
:
/* case: error, abort processing */
/* case: error, abort processing */
nice_debug
(
"Agent %p : Retransmissions failed, giving up on connectivity check %p"
,
agent
,
p
);
nice_debug
(
"Agent %p : Retransmissions failed, giving up on connectivity check %p"
,
agent
,
p
);
p
->
state
=
NICE_CHECK_FAILED
;
p
->
state
=
NICE_CHECK_FAILED
;
...
@@ -267,7 +266,7 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
...
@@ -267,7 +266,7 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
p
->
stun_message
.
buffer
=
NULL
;
p
->
stun_message
.
buffer
=
NULL
;
p
->
stun_message
.
buffer_len
=
0
;
p
->
stun_message
.
buffer_len
=
0
;
break
;
break
;
case
0
:
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
{
{
/* case: not ready, so schedule a new timeout */
/* case: not ready, so schedule a new timeout */
unsigned
int
timeout
=
stun_timer_remainder
(
&
p
->
timer
);
unsigned
int
timeout
=
stun_timer_remainder
(
&
p
->
timer
);
...
@@ -286,8 +285,10 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
...
@@ -286,8 +285,10 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
keep_timer_going
=
TRUE
;
keep_timer_going
=
TRUE
;
break
;
break
;
}
}
default
:
case
STUN_USAGE_TIMER_RETURN_SUCCESS
:
{
{
unsigned
int
timeout
=
stun_timer_remainder
(
&
p
->
timer
);
/* note: convert from milli to microseconds for g_time_val_add() */
/* note: convert from milli to microseconds for g_time_val_add() */
p
->
next_tick
=
*
now
;
p
->
next_tick
=
*
now
;
g_time_val_add
(
&
p
->
next_tick
,
timeout
*
1000
);
g_time_val_add
(
&
p
->
next_tick
,
timeout
*
1000
);
...
@@ -522,13 +523,12 @@ static gboolean priv_turn_allocate_refresh_retransmissions_tick (gpointer pointe
...
@@ -522,13 +523,12 @@ static gboolean priv_turn_allocate_refresh_retransmissions_tick (gpointer pointe
g_source_unref
(
cand
->
tick_source
);
g_source_unref
(
cand
->
tick_source
);
cand
->
tick_source
=
NULL
;
cand
->
tick_source
=
NULL
;
timeout
=
stun_timer_refresh
(
&
cand
->
timer
);
switch
(
stun_timer_refresh
(
&
cand
->
timer
))
{
switch
(
timeout
)
{
case
STUN_USAGE_TIMER_RETURN_TIMEOUT
:
case
-
1
:
/* Time out */
/* Time out */
refresh_cancel
(
cand
);
refresh_cancel
(
cand
);
break
;
break
;
case
0
:
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
/* Retransmit */
/* Retransmit */
nice_socket_send
(
cand
->
nicesock
,
&
cand
->
server
,
nice_socket_send
(
cand
->
nicesock
,
&
cand
->
server
,
stun_message_length
(
&
cand
->
stun_message
),
(
gchar
*
)
cand
->
stun_buffer
);
stun_message_length
(
&
cand
->
stun_message
),
(
gchar
*
)
cand
->
stun_buffer
);
...
@@ -537,7 +537,8 @@ static gboolean priv_turn_allocate_refresh_retransmissions_tick (gpointer pointe
...
@@ -537,7 +537,8 @@ static gboolean priv_turn_allocate_refresh_retransmissions_tick (gpointer pointe
cand
->
tick_source
=
agent_timeout_add_with_context
(
cand
->
agent
,
timeout
,
cand
->
tick_source
=
agent_timeout_add_with_context
(
cand
->
agent
,
timeout
,
priv_turn_allocate_refresh_retransmissions_tick
,
cand
);
priv_turn_allocate_refresh_retransmissions_tick
,
cand
);
break
;
break
;
default:
case
STUN_USAGE_TIMER_RETURN_SUCCESS
:
timeout
=
stun_timer_remainder
(
&
cand
->
timer
);
cand
->
tick_source
=
agent_timeout_add_with_context
(
cand
->
agent
,
timeout
,
cand
->
tick_source
=
agent_timeout_add_with_context
(
cand
->
agent
,
timeout
,
priv_turn_allocate_refresh_retransmissions_tick
,
cand
);
priv_turn_allocate_refresh_retransmissions_tick
,
cand
);
break
;
break
;
...
...
agent/discovery.c
View file @
f46eba9f
...
@@ -885,16 +885,15 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
...
@@ -885,16 +885,15 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
cand
->
done
=
TRUE
;
cand
->
done
=
TRUE
;
}
}
else
if
(
priv_timer_expired
(
&
cand
->
next_tick
,
&
now
))
{
else
if
(
priv_timer_expired
(
&
cand
->
next_tick
,
&
now
))
{
int
timeout
=
stun_timer_refresh
(
&
cand
->
timer
);
switch
(
stun_timer_refresh
(
&
cand
->
timer
))
{
switch
(
timeout
)
{
case
STUN_USAGE_TIMER_RETURN_TIMEOUT
:
case
-
1
:
/* case: error, abort processing */
/* case: error, abort processing */
cand
->
done
=
TRUE
;
cand
->
done
=
TRUE
;
cand
->
stun_message
.
buffer
=
NULL
;
cand
->
stun_message
.
buffer
=
NULL
;
cand
->
stun_message
.
buffer_len
=
0
;
cand
->
stun_message
.
buffer_len
=
0
;
nice_debug
(
"Agent %p : bind discovery timed out, aborting discovery item."
,
agent
);
nice_debug
(
"Agent %p : bind discovery timed out, aborting discovery item."
,
agent
);
break
;
break
;
case
0
:
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
{
{
/* case: not ready complete, so schedule next timeout */
/* case: not ready complete, so schedule next timeout */
unsigned
int
timeout
=
stun_timer_remainder
(
&
cand
->
timer
);
unsigned
int
timeout
=
stun_timer_remainder
(
&
cand
->
timer
);
...
@@ -914,8 +913,10 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
...
@@ -914,8 +913,10 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
++
not_done
;
/* note: retry later */
++
not_done
;
/* note: retry later */
break
;
break
;
}
}
default
:
case
STUN_USAGE_TIMER_RETURN_SUCCESS
:
{
{
unsigned
int
timeout
=
stun_timer_remainder
(
&
cand
->
timer
);
cand
->
next_tick
=
now
;
cand
->
next_tick
=
now
;
g_time_val_add
(
&
cand
->
next_tick
,
timeout
*
1000
);
g_time_val_add
(
&
cand
->
next_tick
,
timeout
*
1000
);
...
...
socket/turn.c
View file @
f46eba9f
...
@@ -509,9 +509,8 @@ static gboolean
...
@@ -509,9 +509,8 @@ static gboolean
priv_retransmissions_tick_unlocked
(
TurnPriv
*
priv
)
priv_retransmissions_tick_unlocked
(
TurnPriv
*
priv
)
{
{
if
(
priv
->
current_binding_msg
)
{
if
(
priv
->
current_binding_msg
)
{
guint
timeout
=
stun_timer_refresh
(
&
priv
->
current_binding_msg
->
timer
);
switch
(
stun_timer_refresh
(
&
priv
->
current_binding_msg
->
timer
))
{
switch
(
timeout
)
{
case
STUN_USAGE_TIMER_RETURN_TIMEOUT
:
case
-
1
:
/* Time out */
/* Time out */
g_free
(
priv
->
current_binding
);
g_free
(
priv
->
current_binding
);
priv
->
current_binding
=
NULL
;
priv
->
current_binding
=
NULL
;
...
@@ -519,13 +518,13 @@ priv_retransmissions_tick_unlocked (TurnPriv *priv)
...
@@ -519,13 +518,13 @@ priv_retransmissions_tick_unlocked (TurnPriv *priv)
priv
->
current_binding_msg
=
NULL
;
priv
->
current_binding_msg
=
NULL
;
priv_process_pending_bindings
(
priv
);
priv_process_pending_bindings
(
priv
);
break
;
break
;
case
0
:
case
STUN_USAGE_TIMER_RETURN_RETRANSMIT
:
/* Retransmit */
/* Retransmit */
nice_socket_send
(
priv
->
base_socket
,
&
priv
->
server_addr
,
nice_socket_send
(
priv
->
base_socket
,
&
priv
->
server_addr
,
stun_message_length
(
&
priv
->
current_binding_msg
->
message
),
stun_message_length
(
&
priv
->
current_binding_msg
->
message
),
(
gchar
*
)
priv
->
current_binding_msg
->
buffer
);
(
gchar
*
)
priv
->
current_binding_msg
->
buffer
);
break
;
break
;
default
:
case
STUN_USAGE_TIMER_RETURN_SUCCESS
:
break
;
break
;
}
}
}
}
...
...
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