diff options
author | dknn <yoann.blein@free.fr> | 2012-07-15 18:26:38 (GMT) |
---|---|---|
committer | dknn <yoann.blein@free.fr> | 2012-09-22 09:01:49 (GMT) |
commit | 05ef8661b2f42cc5b889f3900b459d8a49a24db3 (patch) | |
tree | 7069699ead4ba74eb91aa37090c80ab25c6db352 /Swiften/ScreenSharing | |
parent | c9ba8e43fc23fccd47531ecea73224b3b9b552c3 (diff) | |
download | swift-contrib-05ef8661b2f42cc5b889f3900b459d8a49a24db3.zip swift-contrib-05ef8661b2f42cc5b889f3900b459d8a49a24db3.tar.bz2 |
Handle all kind of ip in udp and screen sharing
Diffstat (limited to 'Swiften/ScreenSharing')
-rw-r--r-- | Swiften/ScreenSharing/ScreenSharing.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/ScreenSharing/ScreenSharing.cpp b/Swiften/ScreenSharing/ScreenSharing.cpp index be3c8ab..c6c78e0 100644 --- a/Swiften/ScreenSharing/ScreenSharing.cpp +++ b/Swiften/ScreenSharing/ScreenSharing.cpp @@ -52,11 +52,11 @@ bool ScreenSharing::addBestCandidate(boost::shared_ptr<JingleRawUDPTransportPayl // Find the first ip which is not loopback foreach (const NetworkInterface& interface, interfaces) { - if (!interface.isLoopback()) { // exclude loopback + if (!interface.isLoopback() && !interface.getAddresses().empty()) { // exclude loopback serverSocket = udpSocketFactory->createUDPSocket(); - serverSocket->bind(0); + serverSocket->bindOnAvailablePort(interface.getAddresses().front()); - candidate.hostAddressPort = HostAddressPort(interface.getAddresses().front(), serverSocket->getLocalAddress().getPort()); + candidate.hostAddressPort = serverSocket->getLocalAddress(); candidate.type = JingleRawUDPTransportPayload::Candidate::Host; transport->addCandidate(candidate); @@ -65,11 +65,11 @@ bool ScreenSharing::addBestCandidate(boost::shared_ptr<JingleRawUDPTransportPayl } // else loopback for self sharing - if (!interfaces.empty()) { + if (!interfaces.empty() && !interfaces.front().getAddresses().empty()) { serverSocket = udpSocketFactory->createUDPSocket(); - serverSocket->bind(0); + serverSocket->bindOnAvailablePort(interfaces.front().getAddresses().front()); - candidate.hostAddressPort = HostAddressPort(interfaces.front().getAddresses().front(), serverSocket->getLocalAddress().getPort()); + candidate.hostAddressPort = serverSocket->getLocalAddress(); candidate.type = JingleRawUDPTransportPayload::Candidate::Host; transport->addCandidate(candidate); |