summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/ScreenSharing/ScreenSharing.cpp')
-rw-r--r--Swiften/ScreenSharing/ScreenSharing.cpp40
1 files changed, 28 insertions, 12 deletions
diff --git a/Swiften/ScreenSharing/ScreenSharing.cpp b/Swiften/ScreenSharing/ScreenSharing.cpp
index c6c78e0..0a477c2 100644
--- a/Swiften/ScreenSharing/ScreenSharing.cpp
+++ b/Swiften/ScreenSharing/ScreenSharing.cpp
@@ -50,10 +50,11 @@ bool ScreenSharing::addBestCandidate(boost::shared_ptr<JingleRawUDPTransportPayl
PlatformNetworkEnvironment env;
std::vector<NetworkInterface> interfaces = env.getNetworkInterfaces();
+ serverSocket = udpSocketFactory->createUDPSocket();
+
// Find the first ip which is not loopback
- foreach (const NetworkInterface& interface, interfaces) {
+ /*foreach (const NetworkInterface& interface, interfaces) {
if (!interface.isLoopback() && !interface.getAddresses().empty()) { // exclude loopback
- serverSocket = udpSocketFactory->createUDPSocket();
serverSocket->bindOnAvailablePort(interface.getAddresses().front());
candidate.hostAddressPort = serverSocket->getLocalAddress();
@@ -62,19 +63,34 @@ bool ScreenSharing::addBestCandidate(boost::shared_ptr<JingleRawUDPTransportPayl
return true;
}
+ }*/
+
+ foreach (const NetworkInterface& interface, interfaces) {
+ if (!interface.isLoopback()) { // exclude loopback
+ foreach (const HostAddress& addr, interface.getAddresses()) {
+ int port = serverSocket->bindOnAvailablePort(addr);
+ if (!port)
+ continue;
+
+ candidate.hostAddressPort = serverSocket->getLocalAddress();
+ candidate.type = JingleRawUDPTransportPayload::Candidate::Host;
+ transport->addCandidate(candidate);
+
+ return true;
+ }
+ }
}
// else loopback for self sharing
- if (!interfaces.empty() && !interfaces.front().getAddresses().empty()) {
- serverSocket = udpSocketFactory->createUDPSocket();
- serverSocket->bindOnAvailablePort(interfaces.front().getAddresses().front());
-
- candidate.hostAddressPort = serverSocket->getLocalAddress();
- candidate.type = JingleRawUDPTransportPayload::Candidate::Host;
- transport->addCandidate(candidate);
-
- return true;
- }
+ /*if (!interfaces.empty() && !interfaces.front().getAddresses().empty()) {
+ int port = serverSocket->bindOnAvailablePort(interfaces.front().getAddresses().front());
+ if (port) {
+ candidate.hostAddressPort = serverSocket->getLocalAddress();
+ candidate.type = JingleRawUDPTransportPayload::Candidate::Host;
+ transport->addCandidate(candidate);
+ return true;
+ }
+ }*/
return false;
}