Commit d9d3d5c8 authored by Olivier Crête's avatar Olivier Crête

agent: stream_new can't fail

parent f9aac6fd
...@@ -1444,39 +1444,38 @@ nice_agent_add_stream ( ...@@ -1444,39 +1444,38 @@ nice_agent_add_stream (
agent_lock(); agent_lock();
stream = stream_new (n_components); stream = stream_new (n_components);
if (stream) {
agent->streams = g_slist_append (agent->streams, stream); agent->streams = g_slist_append (agent->streams, stream);
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);
} }
stream_initialize_credentials (stream, agent->rng);
ret = stream->id; ret = stream->id;
agent_unlock(); agent_unlock();
......
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