summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/ScreenSharing/ScreenSharing.cpp')
-rw-r--r--Swiften/ScreenSharing/ScreenSharing.cpp12
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);