Commit f2d878a6 authored by Mathieu Duponchelle's avatar Mathieu Duponchelle 🐸

agent: add nice_agent_forget_local_addresses()

parent 2e044ea1
Pipeline #15994 failed with stages
in 62 minutes and 11 seconds
......@@ -3311,6 +3311,34 @@ nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr)
return TRUE;
}
/* With agent lock */
static void priv_forget_local_addresses (NiceAgent *agent)
{
GSList *i;
for (i = agent->local_addresses; i; i = i->next)
{
NiceAddress *a = i->data;
nice_address_free (a);
}
g_slist_free (agent->local_addresses);
agent->local_addresses = NULL;
}
NICEAPI_EXPORT gboolean
nice_agent_forget_local_addresses (NiceAgent *agent)
{
g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE);
agent_lock (agent);
priv_forget_local_addresses (agent);
agent_unlock_and_emit (agent);
return TRUE;
}
/* Recompute foundations of all candidate pairs from a given stream
* having a specific remote candidate
*/
......@@ -5076,7 +5104,6 @@ nice_agent_restart_stream (
static void
nice_agent_dispose (GObject *object)
{
GSList *i;
QueuedSignal *sig;
NiceAgent *agent = NICE_AGENT (object);
......@@ -5093,15 +5120,7 @@ nice_agent_dispose (GObject *object)
priv_remove_keepalive_timer (agent);
for (i = agent->local_addresses; i; i = i->next)
{
NiceAddress *a = i->data;
nice_address_free (a);
}
g_slist_free (agent->local_addresses);
agent->local_addresses = NULL;
priv_forget_local_addresses (agent);
while (agent->streams) {
NiceStream *s = agent->streams->data;
......
......@@ -506,6 +506,19 @@ nice_agent_new_full (GMainContext *ctx,
gboolean
nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr);
/**
* nice_agent_forget_local_addresses:
* @agent: The #NiceAgent Object
*
* Forget all the local addresses previously added using
* nice_agent_add_local_address().
*
* Returns: %TRUE on success, %FALSE on fatal errors
* Since: 0.1.15
*/
gboolean
nice_agent_forget_local_addresses (NiceAgent *agent);
/**
* nice_agent_add_stream:
* @agent: The #NiceAgent Object
......
......@@ -16,6 +16,7 @@ nice_agent_new_reliable
nice_agent_new_full
NiceAgentOption
nice_agent_add_local_address
nice_agent_forget_local_addresses
nice_agent_set_port_range
nice_agent_add_stream
nice_agent_remove_stream
......
......@@ -16,6 +16,7 @@ nice_address_set_ipv6
nice_address_set_port
nice_address_to_string
nice_agent_add_local_address
nice_agent_forget_local_addresses
nice_agent_add_stream
nice_agent_recv
nice_agent_recv_messages
......
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