From bb47e1b9cd2926bed3e63f528e063e462c28975a Mon Sep 17 00:00:00 2001 From: Niels Ole Salscheider Date: Tue, 10 Mar 2020 13:19:31 +0100 Subject: Allow to set multiple STUN servers This way we can for example add a server for IPv4 and one IPv6. --- src/client/QXmppCallManager.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/client/QXmppCallManager.cpp') diff --git a/src/client/QXmppCallManager.cpp b/src/client/QXmppCallManager.cpp index 8ba97c2d..dba05975 100644 --- a/src/client/QXmppCallManager.cpp +++ b/src/client/QXmppCallManager.cpp @@ -38,8 +38,7 @@ #include QXmppCallManagerPrivate::QXmppCallManagerPrivate(QXmppCallManager *qq) - : stunPort(0), - turnPort(0), + : turnPort(0), q(qq) { // Initialize GStreamer @@ -153,16 +152,32 @@ QXmppCall *QXmppCallManager::call(const QString &jid) return call; } -/// Sets the STUN server to use to determine server-reflexive addresses +/// Sets multiple STUN servers to use to determine server-reflexive addresses /// and ports. /// +/// \note This may only be called prior to calling bind(). +/// +/// \param servers List of the STUN servers. +/// +/// \since QXmpp 1.3 + +void QXmppCallManager::setStunServers(const QList> &servers) +{ + d->stunServers = servers; +} + +/// Sets a single STUN server to use to determine server-reflexive addresses +/// and ports. +/// +/// \note This may only be called prior to calling bind(). +/// /// \param host The address of the STUN server. /// \param port The port of the STUN server. void QXmppCallManager::setStunServer(const QHostAddress &host, quint16 port) { - d->stunHost = host; - d->stunPort = port; + d->stunServers.clear(); + d->stunServers.push_back(QPair(host, port)); } /// Sets the TURN server to use to relay packets in double-NAT configurations. -- cgit v1.2.3