diff options
author | Jakub Adam <jakub.adam@collabora.com> | 2019-02-25 11:30:10 +0100 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2019-05-09 01:14:37 +0000 |
commit | e78a492314e4577d33966434708e17eb9e2e52a2 (patch) | |
tree | 2e4607f399e7ba351cb4c95208517f7ca9283a2d /agent | |
parent | 45524a730da88f567b7206bc4dee273ee1a332d0 (diff) | |
download | libnice-e78a492314e4577d33966434708e17eb9e2e52a2.tar.gz |
agent: add nice_agent_close_async() API
Asynchronously closes resources the agent has allocated on remote
servers.
Diffstat (limited to 'agent')
-rw-r--r-- | agent/agent.c | 19 | ||||
-rw-r--r-- | agent/agent.h | 15 |
2 files changed, 34 insertions, 0 deletions
diff --git a/agent/agent.c b/agent/agent.c index 30684bb..dc47ba0 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -6685,3 +6685,22 @@ nice_agent_peer_candidate_gathering_done (NiceAgent *agent, guint stream_id) return result; } +static gboolean +on_agent_refreshes_pruned (NiceAgent *agent, gpointer user_data) +{ + // This is called from a timeout cb with agent lock held + + agent_queue_signal (agent, signals[SIGNAL_CLOSED]); + + return G_SOURCE_REMOVE; +} + +void +nice_agent_close_async (NiceAgent *agent) +{ + agent_lock (agent); + + refresh_prune_agent_async (agent, on_agent_refreshes_pruned); + + agent_unlock (agent); +} diff --git a/agent/agent.h b/agent/agent.h index 688d784..c85ee5e 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -1659,6 +1659,21 @@ nice_agent_peer_candidate_gathering_done ( NiceAgent *agent, guint stream_id); +/** + * nice_agent_close_async: + * @agent: The #NiceAgent object + * + * Asynchronously closes resources the agent has allocated on remote servers. + * The agent will emit "closed" signal when the operation finishes. + * + * Calling this function before freeing the agent makes sure the allocated relay + * ports aren't left behind on TURN server but properly removed. + * + * Since: 0.1.16 + */ +void +nice_agent_close_async (NiceAgent *agent); + G_END_DECLS #endif /* __LIBNICE_AGENT_H__ */ |