summaryrefslogtreecommitdiff
path: root/src/protocol.c
diff options
context:
space:
mode:
authorMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-02-14 18:13:28 +0200
committerMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-02-15 14:43:42 +0200
commit0edb5ebf4391d53214ab44284968e548f74d8faa (patch)
treedc2de41b685a52154a61ab881a6dd40037ae685c /src/protocol.c
parent13d1557121f2a20eb98b8b2d0786d57f1a35edb2 (diff)
Smarter behavior of connection parameters 'discover-stun' and 'stun-server'
'discover-stun' is no longer ignored if 'stun-server' is set. If 'discover-stun' is set to true, 'stun-server' is now ignored. If 'discover-stun' is not set, 'stun-server' is used if that is set, otherwise 'discover-stun' defaults to true. Fixes: fd.o #34227
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 44bbd4d..7d89d6c 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -113,13 +113,14 @@ static TpCMParamSpec rakia_params[] = {
{ "keepalive-interval", DBUS_TYPE_UINT32_AS_STRING, G_TYPE_UINT,
TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GUINT_TO_POINTER(0), PARAM_EASY },
- /* Use SRV DNS lookup to discover STUN server */
+ /* Use SRV DNS lookup to discover STUN server
+ * (defaults to true unless stun-server is set) */
{ "discover-stun", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN,
- TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GUINT_TO_POINTER(TRUE), PARAM_EASY },
+ 0, NULL, PARAM_SET_SEPARATELY },
/* STUN server */
{ "stun-server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL,
- PARAM_EASY },
+ PARAM_SET_SEPARATELY },
/* STUN port */
{ "stun-port", DBUS_TYPE_UINT16_AS_STRING, G_TYPE_UINT,
@@ -274,6 +275,9 @@ new_connection (TpBaseProtocol *protocol,
const gchar *transport;
const gchar *proxy_host;
guint16 port;
+ gboolean discover_stun;
+ gboolean discover_stun_valid;
+ const gchar *stun_server;
gchar *proxy;
RakiaConnectionKeepaliveMechanism keepalive_mechanism;
@@ -310,6 +314,18 @@ new_connection (TpBaseProtocol *protocol,
"transport", transport,
NULL);
+ discover_stun = tp_asv_get_boolean (params, "discover-stun",
+ &discover_stun_valid);
+ stun_server = tp_asv_get_string (params, "stun-server");
+
+ if (!discover_stun_valid && stun_server == NULL)
+ discover_stun = TRUE;
+
+ g_object_set (conn,
+ "discover-stun", discover_stun,
+ "stun-server", stun_server,
+ NULL);
+
for (i = 0; rakia_params[i].name != NULL; i++)
{
if (rakia_params[i].offset == PARAM_SET_SEPARATELY)