summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle André Vadla Ravnås <oleavr@gmail.com>2021-11-02 23:39:30 +0100
committerOle André Vadla Ravnås <oleavr@gmail.com>2021-11-03 18:30:05 +0100
commite451a6cca573fafbbdc5bb5a028c81389f19542d (patch)
tree2f2a37d6d5ff9f1aeaff9944ca70f1370f54a3af
parentc95350259a18af5e9d1c0ceffdb28f66c9663557 (diff)
agent: Handle failure to create TCP TURN socket
E.g. if the server address is IPv6 but the local system cannot reach it, so connect() fails right away.
-rw-r--r--agent/agent.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/agent/agent.c b/agent/agent.c
index 6745bee..875ad5f 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2713,8 +2713,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
if (turn->type == NICE_RELAY_TYPE_TURN_UDP) {
if (agent->use_ice_udp == FALSE || turn_tcp == TRUE) {
- g_slice_free (CandidateDiscovery, cdisco);
- return;
+ goto skip;
}
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
NiceAddress addr = nicesock->addr;
@@ -2750,17 +2749,18 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
/* Ignore tcp candidates if we disabled ice-tcp */
if ((agent->use_ice_udp == FALSE && reliable_tcp == FALSE) ||
(agent->use_ice_tcp == FALSE && reliable_tcp == TRUE)) {
- g_slice_free (CandidateDiscovery, cdisco);
- return;
+ goto skip;
}
if (turn_tcp == FALSE) {
- g_slice_free (CandidateDiscovery, cdisco);
- return;
+ goto skip;
}
cdisco->nicesock = agent_create_tcp_turn_socket (agent, stream,
component, nicesock, &turn->server, turn->type, reliable_tcp);
+ if (!cdisco->nicesock) {
+ goto skip;
+ }
nice_component_attach_socket (component, cdisco->nicesock);
}
@@ -2799,6 +2799,11 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
agent, cdisco);
agent->discovery_list = g_slist_append (agent->discovery_list, cdisco);
++agent->discovery_unsched_items;
+
+ return;
+
+skip:
+ g_slice_free (CandidateDiscovery, cdisco);
}
NICEAPI_EXPORT guint