[Pkg-telepathy-commits] [libnice] 242/265: agent: Factor out creating the TurnServer structure
Simon McVittie
smcv at debian.org
Wed May 14 12:05:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository libnice.
commit 100a31fcaa86c697acd33a224d65c94504abf8d6
Author: Olivier Crête <olivier.crete at collabora.com>
Date: Tue Apr 22 16:25:26 2014 -0400
agent: Factor out creating the TurnServer structure
---
agent/agent.c | 13 ++-----------
agent/component.c | 22 ++++++++++++++++++++++
agent/component.h | 5 +++++
3 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/agent/agent.c b/agent/agent.c
index ddf9319..824b016 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -1930,22 +1930,13 @@ nice_agent_set_relay_info(NiceAgent *agent,
goto done;
}
- turn = g_slice_new0 (TurnServer);
+ turn = turn_server_new (server_ip, server_port, username, password, type);
- nice_address_init (&turn->server);
-
- if (nice_address_set_from_string (&turn->server, server_ip)) {
- nice_address_set_port (&turn->server, server_port);
- } else {
- g_slice_free (TurnServer, turn);
+ if (!turn) {
ret = FALSE;
goto done;
}
- turn->username = g_strdup (username);
- turn->password = g_strdup (password);
- turn->type = type;
-
nice_debug ("Agent %p: added relay server [%s]:%d of type %d to s/c %d/%d "
"with user/pass : %s -- %s", agent, server_ip, server_port, type,
stream_id, component_id, username, password);
diff --git a/agent/component.c b/agent/component.c
index 4062a6b..9c82c0a 100644
--- a/agent/component.c
+++ b/agent/component.c
@@ -1070,3 +1070,25 @@ component_input_source_new (NiceAgent *agent, guint stream_id,
return (GSource *) component_source;
}
+
+
+TurnServer *
+turn_server_new (const gchar *server_ip, guint server_port,
+ const gchar *username, const gchar *password, NiceRelayType type)
+{
+ TurnServer *turn = g_slice_new (TurnServer);
+
+ nice_address_init (&turn->server);
+
+ if (nice_address_set_from_string (&turn->server, server_ip)) {
+ nice_address_set_port (&turn->server, server_port);
+ } else {
+ g_slice_free (TurnServer, turn);
+ return NULL;
+ }
+ turn->username = g_strdup (username);
+ turn->password = g_strdup (password);
+ turn->type = type;
+
+ return turn;
+}
diff --git a/agent/component.h b/agent/component.h
index af9b0b5..699118a 100644
--- a/agent/component.h
+++ b/agent/component.h
@@ -260,6 +260,11 @@ component_has_io_callback (Component *component);
void
component_clean_turn_servers (Component *component);
+
+TurnServer *
+turn_server_new (const gchar *server_ip, guint server_port,
+ const gchar *username, const gchar *password, NiceRelayType type);
+
G_END_DECLS
#endif /* _NICE_COMPONENT_H */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git
More information about the Pkg-telepathy-commits
mailing list