Commit df2db74e authored by Olivier Crête's avatar Olivier Crête 👻

discovery: Remove useless checks from discovery_add_local_host_candidate

parent be2706da
......@@ -465,55 +465,47 @@ NiceCandidate *discovery_add_local_host_candidate (
return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_HOST);
if (candidate) {
candidate->stream_id = stream_id;
candidate->component_id = component_id;
candidate->addr = *address;
candidate->base_addr = *address;
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 (candidate);
}
candidate->stream_id = stream_id;
candidate->component_id = component_id;
candidate->addr = *address;
candidate->base_addr = *address;
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 (candidate);
}
priv_generate_candidate_credentials (agent, candidate);
priv_assign_foundation (agent, candidate);
priv_generate_candidate_credentials (agent, candidate);
priv_assign_foundation (agent, candidate);
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
udp_socket = nice_udp_bsd_socket_new (address);
if (udp_socket) {
gboolean result;
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
udp_socket = nice_udp_bsd_socket_new (address);
if (udp_socket) {
gboolean result;
_priv_set_socket_tos (agent, udp_socket, stream->tos);
agent_attach_stream_component_socket (agent, stream,
component, udp_socket);
_priv_set_socket_tos (agent, udp_socket, stream->tos);
agent_attach_stream_component_socket (agent, stream,
component, udp_socket);
candidate->sockptr = udp_socket;
candidate->addr = udp_socket->addr;
candidate->base_addr = udp_socket->addr;
candidate->sockptr = udp_socket;
candidate->addr = udp_socket->addr;
candidate->base_addr = udp_socket->addr;
result = priv_add_local_candidate_pruned (component, candidate);
result = priv_add_local_candidate_pruned (component, candidate);
if (result == TRUE) {
GSList *modified_list = g_slist_append (component->sockets, udp_socket);
if (modified_list) {
/* success: store a pointer to the sockaddr */
component->sockets = modified_list;
agent_signal_new_candidate (agent, candidate);
} else { /* error: list memory allocation */
candidate = NULL; /* note: candidate already owned by component */
}
} else {
/* error: memory allocation, or duplicate candidates */
errors = TRUE;
}
if (result == TRUE) {
component->sockets = g_slist_append (component->sockets, udp_socket);
agent_signal_new_candidate (agent, candidate);
} else {
/* error: socket new */
/* error: duplicate candidates */
errors = TRUE;
}
} else {
/* error: socket new */
errors = TRUE;
}
/* clean up after errors */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment