Commit 6f5dd4a3 authored by Olivier Crête's avatar Olivier Crête 👻

agent: Remove useless checks from nice_agent_add_stream

parent 2ea8108c
...@@ -1439,49 +1439,42 @@ nice_agent_add_stream ( ...@@ -1439,49 +1439,42 @@ nice_agent_add_stream (
guint n_components) guint n_components)
{ {
Stream *stream; Stream *stream;
GSList *modified_list = NULL;
guint ret = 0; guint ret = 0;
guint i; guint i;
agent_lock(); agent_lock();
stream = stream_new (n_components); stream = stream_new (n_components);
if (stream) { if (stream) {
modified_list = g_slist_append (agent->streams, stream); agent->streams = g_slist_append (agent->streams, stream);
if (modified_list) { stream->id = agent->next_stream_id++;
stream->id = agent->next_stream_id++; nice_debug ("Agent %p : allocating stream id %u (%p)", agent, stream->id, stream);
nice_debug ("Agent %p : allocating stream id %u (%p)", agent, stream->id, stream); if (agent->reliable) {
if (agent->reliable) { nice_debug ("Agent %p : reliable stream", agent);
nice_debug ("Agent %p : reliable stream", agent); for (i = 0; i < n_components; i++) {
for (i = 0; i < n_components; i++) { Component *component = stream_find_component_by_id (stream, i + 1);
Component *component = stream_find_component_by_id (stream, i + 1); if (component) {
if (component) { TcpUserData *data = g_slice_new0 (TcpUserData);
TcpUserData *data = g_slice_new0 (TcpUserData); PseudoTcpCallbacks tcp_callbacks = {data,
PseudoTcpCallbacks tcp_callbacks = {data, pseudo_tcp_socket_opened,
pseudo_tcp_socket_opened, pseudo_tcp_socket_readable,
pseudo_tcp_socket_readable, pseudo_tcp_socket_writable,
pseudo_tcp_socket_writable, pseudo_tcp_socket_closed,
pseudo_tcp_socket_closed, pseudo_tcp_socket_write_packet};
pseudo_tcp_socket_write_packet}; data->agent = agent;
data->agent = agent; data->stream = stream;
data->stream = stream; data->component = component;
data->component = component; component->tcp_data = data;
component->tcp_data = data; component->tcp = pseudo_tcp_socket_new (0, &tcp_callbacks);
component->tcp = pseudo_tcp_socket_new (0, &tcp_callbacks); adjust_tcp_clock (agent, stream, component);
adjust_tcp_clock (agent, stream, component); nice_debug ("Agent %p: Create Pseudo Tcp Socket for component %d",
nice_debug ("Agent %p: Create Pseudo Tcp Socket for component %d", agent, i+1);
agent, i+1); } else {
} else { nice_debug ("Agent %p: couldn't find component %d", agent, i+1);
nice_debug ("Agent %p: couldn't find component %d", agent, i+1);
}
} }
} }
stream_initialize_credentials (stream, agent->rng);
agent->streams = modified_list;
} }
else
stream_free (stream); stream_initialize_credentials (stream, agent->rng);
} }
ret = stream->id; ret = stream->id;
......
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