Commit 2ea8108c authored by Olivier Crête's avatar Olivier Crête

agent: Remove useless checks from priv_add_new_candidate_discovery_turn

parent c251cbfd
......@@ -1330,19 +1330,12 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
Stream *stream, guint component_id)
{
CandidateDiscovery *cdisco;
GSList *modified_list;
GSList *socket_modified_list;
Component *component = stream_find_component_by_id (stream, component_id);
/* note: no need to check for redundant candidates, as this is
* done later on in the process */
cdisco = g_slice_new0 (CandidateDiscovery);
if (cdisco) {
modified_list = g_slist_append (agent->discovery_list, cdisco);
if (modified_list) {
Component *component = stream_find_component_by_id (stream, component_id);
cdisco->type = NICE_CANDIDATE_TYPE_RELAYED;
if (turn->type == NICE_RELAY_TYPE_TURN_UDP) {
......@@ -1356,14 +1349,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
_priv_set_socket_tos (agent, new_socket, stream->tos);
agent_attach_stream_component_socket (agent, stream,
component, new_socket);
socket_modified_list = g_slist_append (component->sockets, new_socket);
if (socket_modified_list) {
/* success: store a pointer to the sockaddr */
component->sockets = socket_modified_list;
component->sockets= g_slist_append (component->sockets, new_socket);
socket = new_socket;
} else {
nice_socket_free (new_socket);
}
}
}
cdisco->nicesock = socket;
......@@ -1404,19 +1391,15 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
agent_to_turn_socket_compatibility (agent));
if (!cdisco->nicesock) {
agent->discovery_list = g_slist_remove (modified_list, cdisco);
g_slice_free (CandidateDiscovery, cdisco);
return FALSE;
}
agent_attach_stream_component_socket (agent, stream,
component, cdisco->nicesock);
socket_modified_list = g_slist_append (component->sockets, cdisco->nicesock);
if (socket_modified_list) {
/* success: store a pointer to the sockaddr */
component->sockets = socket_modified_list;
}
component->sockets = g_slist_append (component->sockets, cdisco->nicesock);
}
cdisco->turn = turn;
cdisco->server = turn->server;
......@@ -1444,14 +1427,10 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
nice_debug ("Agent %p : Adding new relay-rflx candidate discovery %p\n",
agent, cdisco);
agent->discovery_list = modified_list;
agent->discovery_list = g_slist_append (agent->discovery_list, cdisco);
++agent->discovery_unsched_items;
}
return TRUE;
}
return FALSE;
}
NICEAPI_EXPORT guint
......
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