summaryrefslogtreecommitdiff
path: root/agent/discovery.c
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2014-04-08 23:56:39 -0400
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2014-05-15 09:44:00 -0400
commitb59c4bb54c135db56729d4187179f16f49b0a4c0 (patch)
tree709058adf758c295786526c210f97eecfa503489 /agent/discovery.c
parent7048b757ab7a37c296a9652daffc8cace8b181bb (diff)
downloadlibnice-b59c4bb54c135db56729d4187179f16f49b0a4c0.tar.gz
Fix crash when discovering peer reflexive candidates in RFC compat
Diffstat (limited to 'agent/discovery.c')
-rw-r--r--agent/discovery.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/agent/discovery.c b/agent/discovery.c
index f63d3dc..94b885e 100644
--- a/agent/discovery.c
+++ b/agent/discovery.c
@@ -763,20 +763,27 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
Component *component,
guint32 priority,
const NiceAddress *remote_address,
- NiceSocket *udp_socket,
+ NiceSocket *nicesock,
NiceCandidate *local,
NiceCandidate *remote)
{
NiceCandidate *candidate;
- /* XXX: for use compiler */
- (void)udp_socket;
-
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE);
candidate->addr = *remote_address;
candidate->base_addr = *remote_address;
- candidate->transport = remote->transport;
+ if (remote)
+ candidate->transport = remote->transport;
+ else if (local)
+ candidate->transport = conn_check_match_transport (local->transport);
+ else {
+ if (nicesock->type == NICE_SOCKET_TYPE_UDP_BSD ||
+ nicesock->type == NICE_SOCKET_TYPE_TURN)
+ candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
+ else
+ candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
+ }
candidate->stream_id = stream->id;
candidate->component_id = component->id;