summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/ScreenSharing/ScreenSharing.cpp')
-rw-r--r--Swiften/ScreenSharing/ScreenSharing.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Swiften/ScreenSharing/ScreenSharing.cpp b/Swiften/ScreenSharing/ScreenSharing.cpp
index fc7f672..532b73d 100644
--- a/Swiften/ScreenSharing/ScreenSharing.cpp
+++ b/Swiften/ScreenSharing/ScreenSharing.cpp
@@ -39,26 +39,26 @@ 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
- candidate.hostAddressPort = HostAddressPort(interface.getAddresses().front(), listeningPort);
+ serverSocket = udpSocketFactory->createUDPSocket();
+ serverSocket->bind(0);
+
+ candidate.hostAddressPort = HostAddressPort(interface.getAddresses().front(), serverSocket->getLocalAddress().getPort());
candidate.type = JingleRawUDPTransportPayload::Candidate::Host;
transport->addCandidate(candidate);
- serverSocket = udpSocketFactory->createUDPSocket();
- serverSocket->bind(listeningPort);
-
return true;
}
}
// else loopback for self sharing
if (!interfaces.empty()) {
- candidate.hostAddressPort = HostAddressPort(interfaces.front().getAddresses().front(), listeningPort);
+ serverSocket = udpSocketFactory->createUDPSocket();
+ serverSocket->bind(0);
+
+ candidate.hostAddressPort = HostAddressPort(interfaces.front().getAddresses().front(), serverSocket->getLocalAddress().getPort());
candidate.type = JingleRawUDPTransportPayload::Candidate::Host;
transport->addCandidate(candidate);
- serverSocket = udpSocketFactory->createUDPSocket();
- serverSocket->bind(listeningPort);
-
return true;
}