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
f4ae3ffc
Commit
f4ae3ffc
authored
May 20, 2010
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
discovery: Remove useless checks from discovery_learn_remote_peer_reflexive_candidate
parent
2664581b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
59 deletions
+50
-59
agent/discovery.c
agent/discovery.c
+50
-59
No files found.
agent/discovery.c
View file @
f4ae3ffc
...
...
@@ -770,76 +770,67 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
(
void
)
udp_socket
;
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
);
if
(
candidate
)
{
GSList
*
modified_list
;
candidate
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
candidate
->
addr
=
*
remote_address
;
candidate
->
base_addr
=
*
remote_address
;
/* if the check didn't contain the PRIORITY attribute, then the priority will
* be 0, which is invalid... */
if
(
priority
!=
0
)
{
candidate
->
priority
=
priority
;
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
candidate
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
candidate
->
addr
=
*
remote_address
;
candidate
->
base_addr
=
*
remote_address
;
/* if the check didn't contain the PRIORITY attribute, then the priority will
* be 0, which is invalid... */
if
(
priority
!=
0
)
{
candidate
->
priority
=
priority
;
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
(
NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE
,
0
,
component
->
id
);
}
candidate
->
stream_id
=
stream
->
id
;
candidate
->
component_id
=
component
->
id
;
}
candidate
->
stream_id
=
stream
->
id
;
candidate
->
component_id
=
component
->
id
;
priv_assign_remote_foundation
(
agent
,
candidate
);
priv_assign_remote_foundation
(
agent
,
candidate
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
&&
remote
&&
local
)
{
guchar
*
new_username
=
NULL
;
guchar
*
decoded_local
=
NULL
;
guchar
*
decoded_remote
=
NULL
;
gsize
local_size
;
gsize
remote_size
;
g_free
(
candidate
->
username
);
g_free
(
candidate
->
password
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
&&
remote
&&
local
)
{
guchar
*
new_username
=
NULL
;
guchar
*
decoded_local
=
NULL
;
guchar
*
decoded_remote
=
NULL
;
gsize
local_size
;
gsize
remote_size
;
g_free
(
candidate
->
username
);
g_free
(
candidate
->
password
);
decoded_local
=
g_base64_decode
(
local
->
username
,
&
local_size
);
decoded_remote
=
g_base64_decode
(
remote
->
username
,
&
remote_size
);
decoded_local
=
g_base64_decode
(
local
->
username
,
&
local_size
);
decoded_remote
=
g_base64_decode
(
remote
->
username
,
&
remote_size
);
new_username
=
g_new0
(
guchar
,
local_size
+
remote_size
);
memcpy
(
new_username
,
decoded_remote
,
remote_size
);
memcpy
(
new_username
+
remote_size
,
decoded_local
,
local_size
);
new_username
=
g_new0
(
guchar
,
local_size
+
remote_size
);
memcpy
(
new_username
,
decoded_remote
,
remote_size
);
memcpy
(
new_username
+
remote_size
,
decoded_local
,
local_size
);
candidate
->
username
=
g_base64_encode
(
new_username
,
local_size
+
remote_size
);
g_free
(
new_username
);
g_free
(
decoded_local
);
g_free
(
decoded_remote
);
candidate
->
username
=
g_base64_encode
(
new_username
,
local_size
+
remote_size
);
g_free
(
new_username
);
g_free
(
decoded_local
);
g_free
(
decoded_remote
);
candidate
->
password
=
g_strdup
(
remote
->
password
);
}
else
if
(
remote
)
{
g_free
(
candidate
->
username
);
g_free
(
candidate
->
password
);
candidate
->
username
=
g_strdup
(
remote
->
username
);
candidate
->
password
=
g_strdup
(
remote
->
password
);
}
candidate
->
password
=
g_strdup
(
remote
->
password
);
}
else
if
(
remote
)
{
g_free
(
candidate
->
username
);
g_free
(
candidate
->
password
);
candidate
->
username
=
g_strdup
(
remote
->
username
);
candidate
->
password
=
g_strdup
(
remote
->
password
);
}
candidate
->
sockptr
=
NULL
;
/* not stored for remote candidates */
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
candidate
->
sockptr
=
NULL
;
/* not stored for remote candidates */
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
component
->
remote_candidates
=
g_slist_append
(
component
->
remote_candidates
,
candidate
);
modified_list
=
g_slist_append
(
component
->
remote_candidates
,
candidate
);
if
(
modified_list
)
{
component
->
remote_candidates
=
modified_list
;
agent_signal_new_remote_candidate
(
agent
,
candidate
);
}
else
{
/* error: memory alloc / list */
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
}
}
agent_signal_new_remote_candidate
(
agent
,
candidate
);
return
candidate
;
}
...
...
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