summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-04-15 13:50:39 (GMT)
committerOlivier CrĂȘte <olivier.crete@collabora.com>2014-04-25 01:03:46 (GMT)
commitab7ac2cef39d0a65cbd09567d625e99a41d044d0 (patch)
tree8670e772df6f920ac6304f13ad8fb62182745be5
parent648571db2fe74dcff9e3ef41d9d6b6f38066f8be (diff)
downloadlibnice-ab7ac2cef39d0a65cbd09567d625e99a41d044d0.tar.gz
libnice-ab7ac2cef39d0a65cbd09567d625e99a41d044d0.tar.xz
factor out: component_clean_turn_servers()
-rw-r--r--agent/component.c24
-rw-r--r--agent/component.h3
2 files changed, 19 insertions, 8 deletions
diff --git a/agent/component.c b/agent/component.c
index 9c2ab43..fa323e2 100644
--- a/agent/component.c
+++ b/agent/component.c
@@ -146,10 +146,24 @@ component_new (guint id, NiceAgent *agent, Stream *stream)
}
void
+component_clean_turn_servers (Component *cmp)
+{
+ GList *item;
+
+ for (item = cmp->turn_servers; item; item = g_list_next (item)) {
+ TurnServer *turn = item->data;
+ g_free (turn->username);
+ g_free (turn->password);
+ g_slice_free (TurnServer, turn);
+ }
+ g_list_free (cmp->turn_servers);
+ cmp->turn_servers = NULL;
+}
+
+void
component_free (Component *cmp)
{
GSList *i;
- GList *item;
IOCallbackData *data;
GOutputVector *vec;
@@ -178,13 +192,7 @@ component_free (Component *cmp)
component_free_socket_sources (cmp);
g_slist_free (cmp->incoming_checks);
- for (item = cmp->turn_servers; item; item = g_list_next (item)) {
- TurnServer *turn = item->data;
- g_free (turn->username);
- g_free (turn->password);
- g_slice_free (TurnServer, turn);
- }
- g_list_free (cmp->turn_servers);
+ component_clean_turn_servers (cmp);
if (cmp->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (cmp->selected_pair.keepalive.tick_source);
diff --git a/agent/component.h b/agent/component.h
index 6f464ed..af9b0b5 100644
--- a/agent/component.h
+++ b/agent/component.h
@@ -257,6 +257,9 @@ component_emit_io_callback (Component *component,
gboolean
component_has_io_callback (Component *component);
+void
+component_clean_turn_servers (Component *component);
+
G_END_DECLS
#endif /* _NICE_COMPONENT_H */