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
c61cac39
Commit
c61cac39
authored
Aug 21, 2014
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent: Factor out peer reflexive priority calculation
parent
9d77c426
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
25 deletions
+29
-25
agent/conncheck.c
agent/conncheck.c
+29
-25
No files found.
agent/conncheck.c
View file @
c61cac39
...
@@ -546,6 +546,33 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
...
@@ -546,6 +546,33 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
return
FALSE
;
return
FALSE
;
}
}
static
guint32
peer_reflexive_candidate_priority
(
NiceAgent
*
agent
,
NiceCandidate
*
local_candidate
)
{
NiceCandidate
*
candidate_priority
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
);
guint32
priority
;
candidate_priority
->
transport
=
local_candidate
->
transport
;
candidate_priority
->
component_id
=
local_candidate
->
component_id
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
priority
=
nice_candidate_jingle_priority
(
candidate_priority
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
priority
=
nice_candidate_msn_priority
(
candidate_priority
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007R2
)
{
priority
=
nice_candidate_ms_ice_priority
(
candidate_priority
,
agent
->
reliable
,
FALSE
);
}
else
{
priority
=
nice_candidate_ice_priority
(
candidate_priority
,
agent
->
reliable
,
FALSE
);
}
nice_candidate_free
(
candidate_priority
);
return
priority
;
}
/*
/*
* Timer callback that handles initiating and managing connectivity
* Timer callback that handles initiating and managing connectivity
...
@@ -578,7 +605,6 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
...
@@ -578,7 +605,6 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
||
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
||
agent
->
keepalive_conncheck
)
{
agent
->
keepalive_conncheck
)
{
NiceCandidate
*
candidate_priority
;
guint32
priority
;
guint32
priority
;
uint8_t
uname
[
NICE_STREAM_MAX_UNAME
];
uint8_t
uname
[
NICE_STREAM_MAX_UNAME
];
size_t
uname_len
=
size_t
uname_len
=
...
@@ -589,13 +615,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
...
@@ -589,13 +615,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
size_t
password_len
=
priv_get_password
(
agent
,
size_t
password_len
=
priv_get_password
(
agent
,
agent_find_stream
(
agent
,
stream
->
id
),
p
->
remote
,
&
password
);
agent_find_stream
(
agent
,
stream
->
id
),
p
->
remote
,
&
password
);
candidate_priority
=
nice_candidate_new
(
priority
=
peer_reflexive_candidate_priority
(
agent
,
p
->
local
);
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
);
candidate_priority
->
transport
=
p
->
local
->
transport
;
candidate_priority
->
component_id
=
p
->
local
->
component_id
;
/* FIXME: This is not always jingle */
priority
=
nice_candidate_jingle_priority
(
candidate_priority
);
nice_candidate_free
(
candidate_priority
);
if
(
nice_debug_is_enabled
())
{
if
(
nice_debug_is_enabled
())
{
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
...
@@ -1719,7 +1739,6 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
...
@@ -1719,7 +1739,6 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
* - ICE-CONTROLLED/ICE-CONTROLLING (for role conflicts)
* - ICE-CONTROLLED/ICE-CONTROLLING (for role conflicts)
* - USE-CANDIDATE (if sent by the controlling agent)
* - USE-CANDIDATE (if sent by the controlling agent)
*/
*/
NiceCandidate
*
candidate_priority
;
guint32
priority
;
guint32
priority
;
uint8_t
uname
[
NICE_STREAM_MAX_UNAME
];
uint8_t
uname
[
NICE_STREAM_MAX_UNAME
];
...
@@ -1736,22 +1755,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
...
@@ -1736,22 +1755,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
size_t
buffer_len
;
size_t
buffer_len
;
unsigned
int
timeout
;
unsigned
int
timeout
;
candidate_priority
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
);
priority
=
peer_reflexive_candidate_priority
(
agent
,
pair
->
local
);
candidate_priority
->
transport
=
pair
->
local
->
transport
;
candidate_priority
->
component_id
=
pair
->
local
->
component_id
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
priority
=
nice_candidate_jingle_priority
(
candidate_priority
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
priority
=
nice_candidate_msn_priority
(
candidate_priority
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007R2
)
{
priority
=
nice_candidate_ms_ice_priority
(
candidate_priority
,
agent
->
reliable
,
FALSE
);
}
else
{
priority
=
nice_candidate_ice_priority
(
candidate_priority
,
agent
->
reliable
,
FALSE
);
}
nice_candidate_free
(
candidate_priority
);
if
(
password
!=
NULL
&&
if
(
password
!=
NULL
&&
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
...
...
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