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
2664581b
Commit
2664581b
authored
May 20, 2010
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
discovery: Remove useless checks from discovery_add_peer_reflexive_candidate
parent
714f1ee6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
54 deletions
+52
-54
agent/discovery.c
agent/discovery.c
+52
-54
No files found.
agent/discovery.c
View file @
2664581b
...
@@ -663,7 +663,7 @@ discovery_add_relay_candidate (
...
@@ -663,7 +663,7 @@ discovery_add_relay_candidate (
*
*
* @return pointer to the created candidate, or NULL on error
* @return pointer to the created candidate, or NULL on error
*/
*/
NiceCandidate
*
NiceCandidate
*
discovery_add_peer_reflexive_candidate
(
discovery_add_peer_reflexive_candidate
(
NiceAgent
*
agent
,
NiceAgent
*
agent
,
guint
stream_id
,
guint
stream_id
,
...
@@ -676,71 +676,69 @@ discovery_add_peer_reflexive_candidate (
...
@@ -676,71 +676,69 @@ discovery_add_peer_reflexive_candidate (
NiceCandidate
*
candidate
;
NiceCandidate
*
candidate
;
Component
*
component
;
Component
*
component
;
Stream
*
stream
;
Stream
*
stream
;
gboolean
result
;
if
(
!
agent_find_component
(
agent
,
stream_id
,
component_id
,
&
stream
,
&
component
))
if
(
!
agent_find_component
(
agent
,
stream_id
,
component_id
,
&
stream
,
&
component
))
return
NULL
;
return
NULL
;
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
);
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
);
if
(
candidate
)
{
gboolean
result
;
candidate
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
candidate
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
candidate
->
priority
=
nice_candidate_ice_priority_full
(
NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE
,
0
,
component_id
);
(
NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE
,
0
,
component_id
);
}
}
candidate
->
stream_id
=
stream_id
;
candidate
->
stream_id
=
stream_id
;
candidate
->
component_id
=
component_id
;
candidate
->
component_id
=
component_id
;
candidate
->
addr
=
*
address
;
candidate
->
addr
=
*
address
;
candidate
->
base_addr
=
base_socket
->
addr
;
candidate
->
base_addr
=
base_socket
->
addr
;
priv_assign_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
);
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_local
,
local_size
);
memcpy
(
new_username
+
local_size
,
decoded_remote
,
remote_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
->
password
=
g_strdup
(
local
->
password
);
priv_assign_foundation
(
agent
,
candidate
);
}
else
if
(
local
)
{
g_free
(
candidate
->
username
);
g_free
(
candidate
->
password
);
candidate
->
username
=
g_strdup
(
local
->
username
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
&&
candidate
->
password
=
g_strdup
(
local
->
password
);
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
);
new_username
=
g_new0
(
guchar
,
local_size
+
remote_size
);
memcpy
(
new_username
,
decoded_local
,
local_size
);
memcpy
(
new_username
+
local_size
,
decoded_remote
,
remote_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
->
password
=
g_strdup
(
local
->
password
);
}
else
if
(
local
)
{
g_free
(
candidate
->
username
);
g_free
(
candidate
->
password
);
candidate
->
username
=
g_strdup
(
local
->
username
);
candidate
->
password
=
g_strdup
(
local
->
password
);
}
/* step: link to the base candidate+socket */
/* step: link to the base candidate+socket */
candidate
->
sockptr
=
base_socket
;
candidate
->
sockptr
=
base_socket
;
candidate
->
base_addr
=
base_socket
->
addr
;
candidate
->
base_addr
=
base_socket
->
addr
;
result
=
priv_add_local_candidate_pruned
(
component
,
candidate
);
result
=
priv_add_local_candidate_pruned
(
component
,
candidate
);
if
(
result
!=
TRUE
)
{
if
(
result
!=
TRUE
)
{
/* error: memory allocation, or duplicate candidatet */
/* error: memory allocation, or duplicate candidatet */
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
}
}
}
return
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