Commit 7d0b3ab4 authored by Olivier Crête's avatar Olivier Crête 👻 Committed by Olivier Crête
Browse files

agent: Move UPnP handling to each stream

Also rewrite the logic a little, and try to make the code a little clearer.
parent 17c6d299
Pipeline #216191 passed with stages
in 2 minutes and 35 seconds
......@@ -166,12 +166,10 @@ struct _NiceAgent
"Determining Role" ID-19) */
NiceCompatibility compatibility; /* property: Compatibility mode */
gboolean media_after_tick; /* Received media after keepalive tick */
gboolean upnp_enabled; /* whether UPnP discovery is enabled */
#ifdef HAVE_GUPNP
GUPnPSimpleIgdThread* upnp; /* GUPnP Single IGD agent */
gboolean upnp_enabled; /* whether UPnP discovery is enabled */
guint upnp_timeout; /* UPnP discovery timeout */
GSList *upnp_mapping; /* NiceAddresses of cands being mapped */
GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif
gchar *software_attribute; /* SOFTWARE attribute */
gboolean reliable; /* property: reliable */
......@@ -246,7 +244,7 @@ StunUsageIceCompatibility agent_to_ice_compatibility (NiceAgent *agent);
StunUsageTurnCompatibility agent_to_turn_compatibility (NiceAgent *agent);
NiceTurnSocketCompatibility agent_to_turn_socket_compatibility (NiceAgent *agent);
void agent_remove_local_candidate (NiceAgent *agent,
void agent_remove_local_candidate (NiceAgent *agent, NiceStream *stream,
NiceCandidate *candidate);
void nice_agent_init_stun_agent (NiceAgent *agent, StunAgent *stun_agent);
......
This diff is collapsed.
......@@ -197,8 +197,8 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp,
conn_check_prune_socket (agent, stream, cmp, candidate->sockptr);
nice_component_detach_socket (cmp, candidate->sockptr);
}
agent_remove_local_candidate (agent, (NiceCandidate *) candidate);
nice_candidate_free ((NiceCandidate *) candidate);
agent_remove_local_candidate (agent, stream, (NiceCandidate *) candidate);
nice_candidate_free ((NiceCandidate *)candidate);
cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i);
i = next;
......@@ -289,7 +289,7 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp)
cmp->selected_pair.priority = 0;
cmp->turn_candidate = candidate;
} else {
agent_remove_local_candidate (agent, (NiceCandidate *) candidate);
agent_remove_local_candidate (agent, stream, (NiceCandidate *) candidate);
relay_candidates = g_slist_append(relay_candidates, candidate);
}
cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i);
......@@ -324,7 +324,7 @@ nice_component_clear_selected_pair (NiceComponent *component)
/* Must be called with the agent lock held as it touches internal Component
* state. */
void
nice_component_close (NiceAgent *agent, NiceComponent *cmp)
nice_component_close (NiceAgent *agent, NiceStream *stream, NiceComponent *cmp)
{
IOCallbackData *data;
GOutputVector *vec;
......@@ -353,7 +353,7 @@ nice_component_close (NiceAgent *agent, NiceComponent *cmp)
cmp->turn_candidate = NULL;
while (cmp->local_candidates) {
agent_remove_local_candidate (agent, cmp->local_candidates->data);
agent_remove_local_candidate (agent, stream, cmp->local_candidates->data);
nice_candidate_free (cmp->local_candidates->data);
cmp->local_candidates = g_slist_delete_link (cmp->local_candidates,
cmp->local_candidates);
......
......@@ -236,7 +236,8 @@ NiceComponent *
nice_component_new (guint component_id, NiceAgent *agent, NiceStream *stream);
void
nice_component_close (NiceAgent *agent, NiceComponent *component);
nice_component_close (NiceAgent *agent, NiceStream *stream,
NiceComponent *component);
gboolean
nice_component_find_pair (NiceComponent *component, NiceAgent *agent,
......
......@@ -89,7 +89,7 @@ nice_stream_close (NiceAgent *agent, NiceStream *stream)
for (i = stream->components; i; i = i->next) {
NiceComponent *component = i->data;
nice_component_close (agent, component);
nice_component_close (agent, stream, component);
}
}
......
......@@ -90,6 +90,12 @@ struct _NiceStream {
gboolean peer_gathering_done;
gint tos;
guint tick_counter;
#ifdef HAVE_GUPNP
GSList *upnp_mapping; /* NiceCandidate being mapped */
GSList *upnp_mapped; /* NiceCandidate mapped with UPnP */
GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif
};
typedef struct {
......
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