Commit 4ee70c86 authored by Youness Alaoui's avatar Youness Alaoui

Merge remote branch 'tester/misc-fixes' into nice-kakaroto

Conflicts:
	agent/agent.c
parents 358a999f 3b16d8b0
...@@ -1294,22 +1294,18 @@ agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandi ...@@ -1294,22 +1294,18 @@ agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandi
return nice_candidate_pair_priority (remote->priority, local->priority); return nice_candidate_pair_priority (remote->priority, local->priority);
} }
static gboolean static void
priv_add_new_candidate_discovery_stun (NiceAgent *agent, priv_add_new_candidate_discovery_stun (NiceAgent *agent,
NiceSocket *socket, NiceAddress server, NiceSocket *socket, NiceAddress server,
Stream *stream, guint component_id) Stream *stream, guint component_id)
{ {
CandidateDiscovery *cdisco; CandidateDiscovery *cdisco;
GSList *modified_list;
/* note: no need to check for redundant candidates, as this is /* note: no need to check for redundant candidates, as this is
* done later on in the process */ * done later on in the process */
cdisco = g_slice_new0 (CandidateDiscovery); cdisco = g_slice_new0 (CandidateDiscovery);
if (cdisco) {
modified_list = g_slist_append (agent->discovery_list, cdisco);
if (modified_list) {
cdisco->type = NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE; cdisco->type = NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE;
cdisco->nicesock = socket; cdisco->nicesock = socket;
cdisco->server = server; cdisco->server = server;
...@@ -1321,35 +1317,23 @@ priv_add_new_candidate_discovery_stun (NiceAgent *agent, ...@@ -1321,35 +1317,23 @@ priv_add_new_candidate_discovery_stun (NiceAgent *agent,
nice_debug ("Agent %p : Adding new srv-rflx candidate discovery %p\n", nice_debug ("Agent %p : Adding new srv-rflx candidate discovery %p\n",
agent, cdisco); agent, cdisco);
agent->discovery_list = modified_list;
++agent->discovery_unsched_items;
}
return TRUE; agent->discovery_list = g_slist_append (agent->discovery_list, cdisco);
} ++agent->discovery_unsched_items;
return FALSE;
} }
static gboolean static void
priv_add_new_candidate_discovery_turn (NiceAgent *agent, priv_add_new_candidate_discovery_turn (NiceAgent *agent,
NiceSocket *socket, TurnServer *turn, NiceSocket *socket, TurnServer *turn,
Stream *stream, guint component_id) Stream *stream, guint component_id)
{ {
CandidateDiscovery *cdisco; CandidateDiscovery *cdisco;
GSList *modified_list; Component *component = stream_find_component_by_id (stream, component_id);
GSList *socket_modified_list;
/* note: no need to check for redundant candidates, as this is /* note: no need to check for redundant candidates, as this is
* done later on in the process */ * done later on in the process */
cdisco = g_slice_new0 (CandidateDiscovery); 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; cdisco->type = NICE_CANDIDATE_TYPE_RELAYED;
if (turn->type == NICE_RELAY_TYPE_TURN_UDP) { if (turn->type == NICE_RELAY_TYPE_TURN_UDP) {
...@@ -1363,14 +1347,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -1363,14 +1347,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
_priv_set_socket_tos (agent, new_socket, stream->tos); _priv_set_socket_tos (agent, new_socket, stream->tos);
agent_attach_stream_component_socket (agent, stream, agent_attach_stream_component_socket (agent, stream,
component, new_socket); component, new_socket);
socket_modified_list = g_slist_append (component->sockets, new_socket); component->sockets= g_slist_append (component->sockets, new_socket);
if (socket_modified_list) {
/* success: store a pointer to the sockaddr */
component->sockets = socket_modified_list;
socket = new_socket; socket = new_socket;
} else {
nice_socket_free (new_socket);
}
} }
} }
cdisco->nicesock = socket; cdisco->nicesock = socket;
...@@ -1410,20 +1388,11 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -1410,20 +1388,11 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
cdisco->nicesock = nice_tcp_turn_socket_new (agent, socket, cdisco->nicesock = nice_tcp_turn_socket_new (agent, socket,
agent_to_turn_socket_compatibility (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, agent_attach_stream_component_socket (agent, stream,
component, cdisco->nicesock); component, cdisco->nicesock);
socket_modified_list = g_slist_append (component->sockets, cdisco->nicesock); component->sockets = g_slist_append (component->sockets, cdisco->nicesock);
if (socket_modified_list) {
/* success: store a pointer to the sockaddr */
component->sockets = socket_modified_list;
}
} }
cdisco->turn = turn; cdisco->turn = turn;
cdisco->server = turn->server; cdisco->server = turn->server;
...@@ -1451,14 +1420,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -1451,14 +1420,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
nice_debug ("Agent %p : Adding new relay-rflx candidate discovery %p\n", nice_debug ("Agent %p : Adding new relay-rflx candidate discovery %p\n",
agent, cdisco); agent, cdisco);
agent->discovery_list = modified_list; agent->discovery_list = g_slist_append (agent->discovery_list, cdisco);
++agent->discovery_unsched_items; ++agent->discovery_unsched_items;
}
return TRUE;
}
return FALSE;
} }
NICEAPI_EXPORT guint NICEAPI_EXPORT guint
...@@ -1467,15 +1430,13 @@ nice_agent_add_stream ( ...@@ -1467,15 +1430,13 @@ 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) {
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) {
...@@ -1506,12 +1467,6 @@ nice_agent_add_stream ( ...@@ -1506,12 +1467,6 @@ nice_agent_add_stream (
stream_initialize_credentials (stream, agent->rng); stream_initialize_credentials (stream, agent->rng);
agent->streams = modified_list;
}
else
stream_free (stream);
}
ret = stream->id; ret = stream->id;
agent_unlock(); agent_unlock();
...@@ -1703,7 +1658,7 @@ static void _upnp_error_mapping_port (GUPnPSimpleIgd *self, GError *error, ...@@ -1703,7 +1658,7 @@ static void _upnp_error_mapping_port (GUPnPSimpleIgd *self, GError *error,
#endif #endif
NICEAPI_EXPORT void NICEAPI_EXPORT gboolean
nice_agent_gather_candidates ( nice_agent_gather_candidates (
NiceAgent *agent, NiceAgent *agent,
guint stream_id) guint stream_id)
...@@ -1788,8 +1743,8 @@ nice_agent_gather_candidates ( ...@@ -1788,8 +1743,8 @@ nice_agent_gather_candidates (
n + 1, addr); n + 1, addr);
if (!host_candidate) { if (!host_candidate) {
g_error ("No host candidate??"); g_warning ("No host candidate??");
break; return FALSE;
} }
#ifdef HAVE_GUPNP #ifdef HAVE_GUPNP
...@@ -1808,20 +1763,13 @@ nice_agent_gather_candidates ( ...@@ -1808,20 +1763,13 @@ nice_agent_gather_candidates (
agent->stun_server_ip) { agent->stun_server_ip) {
NiceAddress stun_server; NiceAddress stun_server;
if (nice_address_set_from_string (&stun_server, agent->stun_server_ip)) { if (nice_address_set_from_string (&stun_server, agent->stun_server_ip)) {
gboolean res;
nice_address_set_port (&stun_server, agent->stun_server_port); nice_address_set_port (&stun_server, agent->stun_server_port);
res =
priv_add_new_candidate_discovery_stun (agent, priv_add_new_candidate_discovery_stun (agent,
host_candidate->sockptr, host_candidate->sockptr,
stun_server, stun_server,
stream, stream,
n + 1); n + 1);
if (res != TRUE) {
/* note: memory allocation failure, return error */
g_error ("Memory allocation failure?");
}
} }
} }
...@@ -1831,17 +1779,11 @@ nice_agent_gather_candidates ( ...@@ -1831,17 +1779,11 @@ nice_agent_gather_candidates (
for (item = component->turn_servers; item; item = item->next) { for (item = component->turn_servers; item; item = item->next) {
TurnServer *turn = item->data; TurnServer *turn = item->data;
gboolean res =
priv_add_new_candidate_discovery_turn (agent, priv_add_new_candidate_discovery_turn (agent,
host_candidate->sockptr, host_candidate->sockptr,
turn, turn,
stream, stream,
n + 1); n + 1);
if (res != TRUE) {
/* note: memory allocation failure, return error */
g_error ("Memory allocation failure?");
}
} }
} }
} }
...@@ -1863,6 +1805,8 @@ nice_agent_gather_candidates ( ...@@ -1863,6 +1805,8 @@ nice_agent_gather_candidates (
done: done:
agent_unlock(); agent_unlock();
return TRUE;
} }
static void priv_free_upnp (NiceAgent *agent) static void priv_free_upnp (NiceAgent *agent)
...@@ -1935,24 +1879,15 @@ NICEAPI_EXPORT gboolean ...@@ -1935,24 +1879,15 @@ NICEAPI_EXPORT gboolean
nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr) nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr)
{ {
NiceAddress *dup; NiceAddress *dup;
GSList *modified_list;
gboolean ret = FALSE;
agent_lock(); agent_lock();
dup = nice_address_dup (addr); dup = nice_address_dup (addr);
nice_address_set_port (dup, 0); nice_address_set_port (dup, 0);
modified_list = g_slist_append (agent->local_addresses, dup); agent->local_addresses = g_slist_append (agent->local_addresses, dup);
if (modified_list) {
agent->local_addresses = modified_list;
ret = TRUE;
goto done;
}
done:
agent_unlock(); agent_unlock();
return ret; return TRUE;
} }
static gboolean priv_add_remote_candidate ( static gboolean priv_add_remote_candidate (
...@@ -1970,7 +1905,6 @@ static gboolean priv_add_remote_candidate ( ...@@ -1970,7 +1905,6 @@ static gboolean priv_add_remote_candidate (
{ {
Component *component; Component *component;
NiceCandidate *candidate; NiceCandidate *candidate;
gboolean error_flag = FALSE;
if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
return FALSE; return FALSE;
...@@ -2013,16 +1947,14 @@ static gboolean priv_add_remote_candidate ( ...@@ -2013,16 +1947,14 @@ static gboolean priv_add_remote_candidate (
candidate->password = g_strdup (password); candidate->password = g_strdup (password);
} }
if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0) if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0)
error_flag = TRUE; goto errors;
} }
else { else {
/* case 2: add a new candidate */ /* case 2: add a new candidate */
candidate = nice_candidate_new (type); candidate = nice_candidate_new (type);
if (candidate) { component->remote_candidates = g_slist_append (component->remote_candidates,
GSList *modified_list = g_slist_append (component->remote_candidates, candidate); candidate);
if (modified_list) {
component->remote_candidates = modified_list;
candidate->stream_id = stream_id; candidate->stream_id = stream_id;
candidate->component_id = component_id; candidate->component_id = component_id;
...@@ -2030,6 +1962,7 @@ static gboolean priv_add_remote_candidate ( ...@@ -2030,6 +1962,7 @@ static gboolean priv_add_remote_candidate (
candidate->type = type; candidate->type = type;
if (addr) if (addr)
candidate->addr = *addr; candidate->addr = *addr;
{ {
gchar tmpbuf[INET6_ADDRSTRLEN] = {0}; gchar tmpbuf[INET6_ADDRSTRLEN] = {0};
if(addr) if(addr)
...@@ -2053,22 +1986,14 @@ static gboolean priv_add_remote_candidate ( ...@@ -2053,22 +1986,14 @@ static gboolean priv_add_remote_candidate (
NICE_CANDIDATE_MAX_FOUNDATION); NICE_CANDIDATE_MAX_FOUNDATION);
if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0) if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0)
error_flag = TRUE; goto errors;
}
else /* memory alloc error: list insert */
error_flag = TRUE;
}
else /* memory alloc error: candidate creation */
error_flag = TRUE;
} }
if (error_flag) { return TRUE;
if (candidate)
errors:
nice_candidate_free (candidate); nice_candidate_free (candidate);
return FALSE; return FALSE;
}
return TRUE;
} }
NICEAPI_EXPORT gboolean NICEAPI_EXPORT gboolean
...@@ -2490,14 +2415,13 @@ io_ctx_new ( ...@@ -2490,14 +2415,13 @@ io_ctx_new (
IOCtx *ctx; IOCtx *ctx;
ctx = g_slice_new0 (IOCtx); ctx = g_slice_new0 (IOCtx);
if (ctx) {
ctx->agent = agent; ctx->agent = agent;
ctx->stream = stream; ctx->stream = stream;
ctx->component = component; ctx->component = component;
ctx->socket = socket; ctx->socket = socket;
ctx->channel = channel; ctx->channel = channel;
ctx->source = source; ctx->source = source;
}
return ctx; return ctx;
} }
......
...@@ -385,6 +385,8 @@ gboolean nice_agent_set_relay_info( ...@@ -385,6 +385,8 @@ gboolean nice_agent_set_relay_info(
* Start the candidate gathering process. * Start the candidate gathering process.
* Once done, #NiceAgent::candidate-gathering-done is called for the stream * Once done, #NiceAgent::candidate-gathering-done is called for the stream
* *
* Returns: %FALSE if there were no local addresses and they couldn't be discovered. In this case, call nice_agent_add_local_address() first.
*
* See also: nice_agent_add_local_address() * See also: nice_agent_add_local_address()
<note> <note>
<para> <para>
...@@ -397,7 +399,7 @@ gboolean nice_agent_set_relay_info( ...@@ -397,7 +399,7 @@ gboolean nice_agent_set_relay_info(
</para> </para>
</note> </note>
*/ */
void gboolean
nice_agent_gather_candidates ( nice_agent_gather_candidates (
NiceAgent *agent, NiceAgent *agent,
guint stream_id); guint stream_id);
......
...@@ -310,21 +310,11 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component, ...@@ -310,21 +310,11 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component,
candidate->transport); candidate->transport);
if (!remote) { if (!remote) {
GSList *modified_list = NULL;
remote = nice_candidate_copy (candidate); remote = nice_candidate_copy (candidate);
component->remote_candidates = g_slist_append (component->remote_candidates,
modified_list = g_slist_append (component->remote_candidates,
remote); remote);
if (modified_list) {
component->remote_candidates = modified_list;
agent_signal_new_remote_candidate (agent, remote); agent_signal_new_remote_candidate (agent, remote);
} }
else { /* error: memory alloc / list */
nice_candidate_free (remote), remote = NULL;
return NULL;
}
}
if (component->selected_pair.keepalive.tick_source != NULL) { if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source); g_source_destroy (component->selected_pair.keepalive.tick_source);
......
...@@ -1249,16 +1249,13 @@ static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Componen ...@@ -1249,16 +1249,13 @@ static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Componen
* Creates a new connectivity check pair and adds it to * Creates a new connectivity check pair and adds it to
* the agent's list of checks. * the agent's list of checks.
*/ */
static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local, NiceCandidate *remote, NiceCheckState initial_state, gboolean use_candidate) static void priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local, NiceCandidate *remote, NiceCheckState initial_state, gboolean use_candidate)
{ {
gboolean result = FALSE;
Stream *stream = agent_find_stream (agent, stream_id); Stream *stream = agent_find_stream (agent, stream_id);
CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair); CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair);
if (pair) {
GSList *modified_list = stream->conncheck_list = g_slist_insert_sorted (stream->conncheck_list, pair,
g_slist_insert_sorted (stream->conncheck_list, pair, (GCompareFunc)conn_check_compare); (GCompareFunc)conn_check_compare);
if (modified_list) {
/* step: allocation and addition succesful, do rest of the work */
pair->agent = agent; pair->agent = agent;
pair->stream_id = stream_id; pair->stream_id = stream_id;
...@@ -1276,9 +1273,7 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp ...@@ -1276,9 +1273,7 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp
/* note: for the first added check */ /* note: for the first added check */
if (!stream->conncheck_list) if (!stream->conncheck_list)
stream->conncheck_state = NICE_CHECKLIST_RUNNING; stream->conncheck_state = NICE_CHECKLIST_RUNNING;
stream->conncheck_list = modified_list;
result = TRUE;
nice_debug ("Agent %p : added a new conncheck %p with foundation of '%s' to list %u.", agent, pair, pair->foundation, stream_id); nice_debug ("Agent %p : added a new conncheck %p with foundation of '%s' to list %u.", agent, pair, pair->foundation, stream_id);
/* implement the hard upper limit for number of /* implement the hard upper limit for number of
...@@ -1287,22 +1282,6 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp ...@@ -1287,22 +1282,6 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp
stream->conncheck_list = stream->conncheck_list =
priv_limit_conn_check_list_size (stream->conncheck_list, agent->max_conn_checks); priv_limit_conn_check_list_size (stream->conncheck_list, agent->max_conn_checks);
} }
if (!stream->conncheck_list) {
stream->conncheck_state = NICE_CHECKLIST_FAILED;
result = FALSE;
}
}
else {
/* memory alloc failed: list insert */
conn_check_free_item (pair, NULL);
stream->conncheck_state = NICE_CHECKLIST_FAILED;
}
}
else { /* memory alloc failed: new pair */
stream->conncheck_state = NICE_CHECKLIST_FAILED;
}
return result;
} }
/* /*
...@@ -1330,8 +1309,6 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component * ...@@ -1330,8 +1309,6 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
if (local->transport == remote->transport && if (local->transport == remote->transport &&
local->addr.s.addr.sa_family == remote->addr.s.addr.sa_family) { local->addr.s.addr.sa_family == remote->addr.s.addr.sa_family) {
gboolean result;
/* note: do not create pairs where local candidate is /* note: do not create pairs where local candidate is
* a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-19) */ * a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-19) */
if ((agent->compatibility == NICE_COMPATIBILITY_RFC5245 || if ((agent->compatibility == NICE_COMPATIBILITY_RFC5245 ||
...@@ -1339,8 +1316,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component * ...@@ -1339,8 +1316,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
local->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE) local->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE)
continue; continue;
result = priv_add_new_check_pair (agent, stream_id, component, local, remote, NICE_CHECK_FROZEN, FALSE); priv_add_new_check_pair (agent, stream_id, component, local, remote, NICE_CHECK_FROZEN, FALSE);
if (result) {
++added; ++added;
if (component->state < NICE_COMPONENT_STATE_CONNECTED) { if (component->state < NICE_COMPONENT_STATE_CONNECTED) {
agent_signal_component_state_change (agent, agent_signal_component_state_change (agent,
...@@ -1354,11 +1330,6 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component * ...@@ -1354,11 +1330,6 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
NICE_COMPONENT_STATE_CONNECTED); NICE_COMPONENT_STATE_CONNECTED);
} }
} }
else {
added = -1;
break;
}
}
} }
return added; return added;
...@@ -1766,7 +1737,7 @@ static guint priv_prune_pending_checks (Stream *stream, guint component_id) ...@@ -1766,7 +1737,7 @@ static guint priv_prune_pending_checks (Stream *stream, guint component_id)
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate) static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate)
{ {
GSList *i; GSList *i;
gboolean result = FALSE; NiceCandidate *local = NULL;
for (i = stream->conncheck_list; i ; i = i->next) { for (i = stream->conncheck_list; i ; i = i->next) {
CandidateCheckPair *p = i->data; CandidateCheckPair *p = i->data;
...@@ -1807,23 +1778,21 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, ...@@ -1807,23 +1778,21 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
} }
} }
{
NiceCandidate *local = NULL;
for (i = component->local_candidates; i ; i = i->next) { for (i = component->local_candidates; i ; i = i->next) {
local = i->data; local = i->data;
if (local->sockptr == local_socket) if (local->sockptr == local_socket)
break; break;
} }
if (i) { if (i) {
nice_debug ("Agent %p : Adding a triggered check to conn.check list (local=%p).", agent, local); nice_debug ("Agent %p : Adding a triggered check to conn.check list (local=%p).", agent, local);
result = priv_add_new_check_pair (agent, stream->id, component, local, remote_cand, NICE_CHECK_WAITING, use_candidate); priv_add_new_check_pair (agent, stream->id, component, local, remote_cand, NICE_CHECK_WAITING, use_candidate);
return TRUE;
} }
else else {
nice_debug ("Agent %p : Didn't find a matching pair for triggered check (remote-cand=%p).", agent, remote_cand); nice_debug ("Agent %p : Didn't find a matching pair for triggered check (remote-cand=%p).", agent, remote_cand);
return FALSE;
} }
return result;
} }
...@@ -1895,10 +1864,7 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component, ...@@ -1895,10 +1864,7 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component,
} }
icheck = g_slice_new0 (IncomingCheck); icheck = g_slice_new0 (IncomingCheck);
if (icheck) { component->incoming_checks = g_slist_append (component->incoming_checks, icheck);
GSList *pending = g_slist_append (component->incoming_checks, icheck);
if (pending) {
component->incoming_checks = pending;
icheck->from = *from; icheck->from = *from;
icheck->local_socket = socket; icheck->local_socket = socket;
icheck->priority = priority; icheck->priority = priority;
...@@ -1907,11 +1873,8 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component, ...@@ -1907,11 +1873,8 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component,
icheck->username = NULL; icheck->username = NULL;
if (username_len > 0) if (username_len > 0)
icheck->username = g_memdup (username, username_len); icheck->username = g_memdup (username, username_len);
return 0;
}
}
return -1; return 0;
} }
/* /*
...@@ -1923,11 +1886,9 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component, ...@@ -1923,11 +1886,9 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component,
static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint stream_id, guint component_id, NiceCandidate *local_cand, CandidateCheckPair *parent_pair) static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint stream_id, guint component_id, NiceCandidate *local_cand, CandidateCheckPair *parent_pair)
{ {
CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair); CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair);
if (pair) {
Stream *stream = agent_find_stream (agent, stream_id); Stream *stream = agent_find_stream (agent, stream_id);
GSList *modified_list = g_slist_append (stream->conncheck_list, pair);
if (modified_list) { stream->conncheck_list = g_slist_append (stream->conncheck_list, pair);
stream->conncheck_list = modified_list;
pair->agent = agent; pair->agent = agent;
pair->stream_id = stream_id; pair->stream_id = stream_id;
pair->component_id = component_id;; pair->component_id = component_id;;
...@@ -1935,19 +1896,19 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint ...@@ -1935,19 +1896,19 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
pair->remote = parent_pair->remote; pair->remote = parent_pair->remote;
pair->state = NICE_CHECK_DISCOVERED; pair->state = NICE_CHECK_DISCOVERED;
nice_debug ("Agent %p : pair %p state DISCOVERED", agent, pair); nice_debug ("Agent %p : pair %p state DISCOVERED", agent, pair);
g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", local_cand->foundation, parent_pair->remote->foundation); g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s",
local_cand->foundation, parent_pair->remote->foundation);
if (agent->controlling_mode == TRUE) if (agent->controlling_mode == TRUE)
pair->priority = nice_candidate_pair_priority (local_cand->priority, parent_pair->priority); pair->priority = nice_candidate_pair_priority (local_cand->priority,
parent_pair->priority);
else else
pair->priority = nice_candidate_pair_priority (parent_pair->priority, local_cand->priority); pair->priority = nice_candidate_pair_priority (parent_pair->priority,
local_cand->priority);
pair->nominated = FALSE; pair->nominated = FALSE;
pair->controlling = agent->controlling_mode; pair->controlling = agent->controlling_mode;
nice_debug ("Agent %p : added a new peer-discovered pair with foundation of '%s'.", agent, pair->foundation); nice_debug ("Agent %p : added a new peer-discovered pair with foundation of '%s'.", agent, pair->foundation);
return pair;
}
}
return NULL; return pair;
} }
/* /*
...@@ -2254,13 +2215,10 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand ...@@ -2254,13 +2215,10 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand
{ {
CandidateRefresh *cand; CandidateRefresh *cand;
NiceAgent *agent = cdisco->agent; NiceAgent *agent = cdisco->agent;
GSList *modified_list;
cand = g_slice_new0 (CandidateRefresh); cand = g_slice_new0 (CandidateRefresh);
if (cand) { agent->refresh_list = g_slist_append (agent->refresh_list, cand);
modified_list = g_slist_append (agent->refresh_list, cand);
if (modified_list) {
cand->nicesock = cdisco->nicesock; cand->nicesock = cdisco->nicesock;
cand->relay_socket = relay_cand->sockptr; cand->relay_socket = relay_cand->sockptr;
cand->server = cdisco->server; cand->server = cdisco->server;
...@@ -2271,7 +2229,6 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand ...@@ -2271,7 +2229,6 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand
memcpy (&cand->stun_agent, &cdisco->stun_agent, sizeof(StunAgent)); memcpy (&cand->stun_agent, &cdisco->stun_agent, sizeof(StunAgent));
nice_debug ("Agent %p : Adding new refresh candidate %p with timeout %d", nice_debug ("Agent %p : Adding new refresh candidate %p with timeout %d",
agent, cand, (lifetime - 60) * 1000); agent, cand, (lifetime - 60) * 1000);
agent->refresh_list = modified_list;
/* step: also start the refresh timer */ /* step: also start the refresh timer */
/* refresh should be sent 1 minute before it expires */ /* refresh should be sent 1 minute before it expires */
...@@ -2280,8 +2237,6 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand ...@@ -2280,8 +2237,6 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand
priv_turn_allocate_refresh_tick, cand); priv_turn_allocate_refresh_tick, cand);
nice_debug ("timer source is : %d", cand->timer_source); nice_debug ("timer source is : %d", cand->timer_source);
}
}
return cand; return cand;
} }
...@@ -2700,8 +2655,6 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -2700,8 +2655,6 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
} }
} }
if (validater_data.password)
g_free (validater_data.password); g_free (validater_data.password);
if (valid == STUN_VALIDATION_NOT_STUN || if (valid == STUN_VALIDATION_NOT_STUN ||
......
...@@ -87,15 +87,12 @@ void discovery_free_item (gpointer data, gpointer user_data) ...@@ -87,15 +87,12 @@ void discovery_free_item (gpointer data, gpointer user_data)
*/ */
void discovery_free (NiceAgent *agent) void discovery_free (NiceAgent *agent)
{ {
if (agent->discovery_list) {
GSList *tmp = agent->discovery_list;
agent->discovery_list = NULL;
g_slist_foreach (tmp, discovery_free_item, NULL);
g_slist_free (tmp);
g_slist_foreach (agent->discovery_list, discovery_free_item, NULL);
g_slist_free (agent->discovery_list);
agent->discovery_list = NULL;
agent->discovery_unsched_items = 0; agent->discovery_unsched_items = 0;
}
if (agent->discovery_timer_source != NULL) { if (agent->discovery_timer_source != NULL) {
g_source_destroy (agent->discovery_timer_source); g_source_destroy (agent->discovery_timer_source);
g_source_unref (agent->discovery_timer_source); g_source_unref (agent->discovery_timer_source);
...@@ -204,14 +201,9 @@ void refresh_free_item (gpointer data, gpointer user_data) ...@@ -204,14 +201,9 @@ void refresh_free_item (gpointer data, gpointer user_data)
*/ */
void refresh_free (NiceAgent *agent) void refresh_free (NiceAgent *agent)
{ {
if (agent->refresh_list) { g_slist_foreach (agent->refresh_list, refresh_free_item, NULL);
GSList *tmp = agent->refresh_list; g_slist_free (agent->refresh_list);
agent->refresh_list = NULL; agent->refresh_list = NULL;
g_slist_foreach (tmp, refresh_free_item, NULL);
g_slist_free (tmp);
}
} }
/* /*
...@@ -252,7 +244,7 @@ void refresh_cancel (CandidateRefresh *refresh) ...@@ -252,7 +244,7 @@ void refresh_cancel (CandidateRefresh *refresh)
*/ */
static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandidate *candidate) static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandidate *candidate)
{ {
GSList *modified_list, *i; GSList *i;
for (i = component->local_candidates; i ; i = i->next) { for (i = component->local_candidates; i ; i = i->next) {
NiceCandidate *c = i->data; NiceCandidate *c = i->data;
...@@ -264,11 +256,8 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi ...@@ -264,11 +256,8 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
} }
} }
modified_list = g_slist_append (component->local_candidates, component->local_candidates = g_slist_append (component->local_candidates,
candidate); candidate);
if (modified_list) {
component->local_candidates = modified_list;
}
return TRUE; return TRUE;
} }
...@@ -418,9 +407,7 @@ void priv_generate_candidate_credentials (NiceAgent *agent, ...@@ -418,9 +407,7 @@ void priv_generate_candidate_credentials (NiceAgent *agent,
guchar username[32]; guchar username[32];
guchar password[16]; guchar password[16];
if (candidate->username)
g_free (candidate->username); g_free (candidate->username);
if (candidate->password)
g_free (candidate->password); g_free (candidate->password);
nice_rng_generate_bytes (agent->rng, 32, (gchar *)username); nice_rng_generate_bytes (agent->rng, 32, (gchar *)username);
...@@ -432,9 +419,7 @@ void priv_generate_candidate_credentials (NiceAgent *agent, ...@@ -432,9 +419,7 @@ void priv_generate_candidate_credentials (NiceAgent *agent,
} else if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { } else if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
gchar username[16]; gchar username[16];
if (candidate->username)
g_free (candidate->username); g_free (candidate->username);
if (candidate->password)
g_free (candidate->password); g_free (candidate->password);
candidate->password = NULL; candidate->password = NULL;
...@@ -462,13 +447,11 @@ NiceCandidate *discovery_add_local_host_candidate ( ...@@ -462,13 +447,11 @@ NiceCandidate *discovery_add_local_host_candidate (
Component *component; Component *component;
Stream *stream; Stream *stream;
NiceSocket *udp_socket = NULL; NiceSocket *udp_socket = NULL;
gboolean errors = FALSE;
if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) if (!agent_find_component (agent, stream_id, component_id, &stream, &component))
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_HOST); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_HOST);
if (candidate) {
candidate->stream_id = stream_id; candidate->stream_id = stream_id;
candidate->component_id = component_id; candidate->component_id = component_id;
candidate->addr = *address; candidate->addr = *address;
...@@ -487,8 +470,9 @@ NiceCandidate *discovery_add_local_host_candidate ( ...@@ -487,8 +470,9 @@ NiceCandidate *discovery_add_local_host_candidate (
/* note: candidate username and password are left NULL as stream /* note: candidate username and password are left NULL as stream
level ufrag/password are used */ level ufrag/password are used */
udp_socket = nice_udp_bsd_socket_new (address); udp_socket = nice_udp_bsd_socket_new (address);
if (udp_socket) { if (!udp_socket)
gboolean result; goto errors;
_priv_set_socket_tos (agent, udp_socket, stream->tos); _priv_set_socket_tos (agent, udp_socket, stream->tos);
agent_attach_stream_component_socket (agent, stream, agent_attach_stream_component_socket (agent, stream,
...@@ -498,36 +482,19 @@ NiceCandidate *discovery_add_local_host_candidate ( ...@@ -498,36 +482,19 @@ NiceCandidate *discovery_add_local_host_candidate (
candidate->addr = udp_socket->addr; candidate->addr = udp_socket->addr;
candidate->base_addr = udp_socket->addr; candidate->base_addr = udp_socket->addr;
result = priv_add_local_candidate_pruned (component, candidate); if (!priv_add_local_candidate_pruned (component, candidate))
goto errors;
if (result == TRUE) { component->sockets = g_slist_append (component->sockets, udp_socket);
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); 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;
}
} else {
/* error: socket new */
errors = TRUE;
}
}
/* clean up after errors */ return candidate;
if (errors) {
if (candidate) errors:
nice_candidate_free (candidate), candidate = NULL; nice_candidate_free (candidate);
if (udp_socket) if (udp_socket)
nice_socket_free (udp_socket); nice_socket_free (udp_socket);
} return NULL;
return candidate;
} }
/* /*
...@@ -553,7 +520,7 @@ discovery_add_server_reflexive_candidate ( ...@@ -553,7 +520,7 @@ discovery_add_server_reflexive_candidate (
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE);
if (candidate) {
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
candidate->priority = nice_candidate_jingle_priority (candidate); candidate->priority = nice_candidate_jingle_priority (candidate);
} else if (agent->compatibility == NICE_COMPATIBILITY_MSN) { } else if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
...@@ -578,10 +545,9 @@ discovery_add_server_reflexive_candidate ( ...@@ -578,10 +545,9 @@ discovery_add_server_reflexive_candidate (
agent_signal_new_candidate (agent, candidate); agent_signal_new_candidate (agent, candidate);
} }
else { else {
/* error: memory allocation, or duplicate candidatet */ /* error: duplicate candidate */
nice_candidate_free (candidate), candidate = NULL; nice_candidate_free (candidate), candidate = NULL;
} }
}
return candidate; return candidate;
} }
...@@ -605,15 +571,13 @@ discovery_add_relay_candidate ( ...@@ -605,15 +571,13 @@ discovery_add_relay_candidate (
NiceCandidate *candidate; NiceCandidate *candidate;
Component *component; Component *component;
Stream *stream; Stream *stream;
gboolean result = FALSE;
gboolean errors = FALSE;
NiceSocket *relay_socket = NULL; NiceSocket *relay_socket = NULL;
if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) if (!agent_find_component (agent, stream_id, component_id, &stream, &component))
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_RELAYED); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_RELAYED);
if (candidate) {
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
candidate->priority = nice_candidate_jingle_priority (candidate); candidate->priority = nice_candidate_jingle_priority (candidate);
} else if (agent->compatibility == NICE_COMPATIBILITY_MSN) { } else if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
...@@ -632,7 +596,9 @@ discovery_add_relay_candidate ( ...@@ -632,7 +596,9 @@ discovery_add_relay_candidate (
base_socket, &turn->server, base_socket, &turn->server,
turn->username, turn->password, turn->username, turn->password,
agent_to_turn_socket_compatibility (agent)); agent_to_turn_socket_compatibility (agent));
if (relay_socket) { if (!relay_socket)
goto errors;
candidate->sockptr = relay_socket; candidate->sockptr = relay_socket;
candidate->base_addr = base_socket->addr; candidate->base_addr = base_socket->addr;
...@@ -646,35 +612,19 @@ discovery_add_relay_candidate ( ...@@ -646,35 +612,19 @@ discovery_add_relay_candidate (
priv_assign_foundation (agent, candidate); priv_assign_foundation (agent, candidate);
result = priv_add_local_candidate_pruned (component, candidate); if (!priv_add_local_candidate_pruned (component, candidate))
if (result) { goto errors;
GSList *modified_list = g_slist_append (component->sockets, relay_socket);
if (modified_list) { component->sockets = g_slist_append (component->sockets, relay_socket);
/* success: store a pointer to the sockaddr */
component->sockets = modified_list;
}
agent_signal_new_candidate (agent, candidate); agent_signal_new_candidate (agent, candidate);
} else {
/* error: memory allocation, or duplicate candidate */
errors = TRUE;
}
} else {
/* error: socket factory make */
errors = TRUE;
}
} else {
/* error: udp socket memory allocation */
errors = TRUE;
}
/* clean up after errors */ return candidate;
if (errors) {
if (candidate) errors:
nice_candidate_free (candidate), candidate = NULL; nice_candidate_free (candidate);
if (relay_socket) if (relay_socket)
nice_socket_free (relay_socket); nice_socket_free (relay_socket);
} return NULL;
return candidate;
} }
/* /*
...@@ -696,13 +646,12 @@ discovery_add_peer_reflexive_candidate ( ...@@ -696,13 +646,12 @@ discovery_add_peer_reflexive_candidate (
NiceCandidate *candidate; NiceCandidate *candidate;
Component *component; Component *component;
Stream *stream; Stream *stream;
gboolean result;
if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) if (!agent_find_component (agent, stream_id, component_id, &stream, &component))
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE);
if (candidate) {
gboolean result;
candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP; candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
...@@ -761,7 +710,6 @@ discovery_add_peer_reflexive_candidate ( ...@@ -761,7 +710,6 @@ discovery_add_peer_reflexive_candidate (
/* error: memory allocation, or duplicate candidatet */ /* error: memory allocation, or duplicate candidatet */
nice_candidate_free (candidate), candidate = NULL; nice_candidate_free (candidate), candidate = NULL;
} }
}
return candidate; return candidate;
} }
...@@ -792,8 +740,6 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate ( ...@@ -792,8 +740,6 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
(void)udp_socket; (void)udp_socket;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE);
if (candidate) {
GSList *modified_list;
candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP; candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
candidate->addr = *remote_address; candidate->addr = *remote_address;
...@@ -847,21 +793,14 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate ( ...@@ -847,21 +793,14 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
candidate->password = g_strdup(remote->password); candidate->password = g_strdup(remote->password);
} }
candidate->sockptr = NULL; /* not stored for remote candidates */ candidate->sockptr = NULL; /* not stored for remote candidates */
/* note: candidate username and password are left NULL as stream /* note: candidate username and password are left NULL as stream
level ufrag/password are used */ level ufrag/password are used */
modified_list = g_slist_append (component->remote_candidates, component->remote_candidates = g_slist_append (component->remote_candidates,
candidate); candidate);
if (modified_list) {
component->remote_candidates = modified_list;
agent_signal_new_remote_candidate (agent, candidate); agent_signal_new_remote_candidate (agent, candidate);
}
else { /* error: memory alloc / list */
nice_candidate_free (candidate), candidate = NULL;
}
}
return candidate; return candidate;
} }
......
...@@ -52,27 +52,12 @@ stream_new (guint n_components) ...@@ -52,27 +52,12 @@ stream_new (guint n_components)
{ {
Stream *stream; Stream *stream;
guint n; guint n;
gboolean errors = FALSE;
GSList *modified_list;
Component *component; Component *component;
stream = g_slice_new0 (Stream); stream = g_slice_new0 (Stream);
for (n = 0; n < n_components; n++) { for (n = 0; n < n_components; n++) {
component = component_new (n + 1); component = component_new (n + 1);
if (component) { stream->components = g_slist_append (stream->components, component);
modified_list = g_slist_append (stream->components, component);
if (modified_list)
stream->components = modified_list;
else
errors = TRUE;
}
else
errors = TRUE;
}
if (errors) {
stream_free (stream);
return NULL;
} }
stream->n_components = n_components; stream->n_components = n_components;
......
...@@ -91,7 +91,7 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr) ...@@ -91,7 +91,7 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr)
int ret; int ret;
struct sockaddr_storage name; struct sockaddr_storage name;
guint name_len = sizeof (name); guint name_len = sizeof (name);
NiceSocket *sock = g_slice_new0 (NiceSocket); NiceSocket *sock;
TcpPriv *priv; TcpPriv *priv;
if (addr == NULL) { if (addr == NULL) {
...@@ -99,6 +99,8 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr) ...@@ -99,6 +99,8 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr)
return NULL; return NULL;
} }
sock = g_slice_new0 (NiceSocket);
nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name); nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name);
if (sockfd == -1) { if (sockfd == -1) {
......
...@@ -73,10 +73,6 @@ nice_udp_bsd_socket_new (NiceAddress *addr) ...@@ -73,10 +73,6 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
socklen_t name_len = sizeof (name); socklen_t name_len = sizeof (name);
NiceSocket *sock = g_slice_new0 (NiceSocket); NiceSocket *sock = g_slice_new0 (NiceSocket);
if (!sock) {
return NULL;
}
if (addr != NULL) { if (addr != NULL) {
nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name); nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name);
} else { } else {
......
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