OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 for (relay_port = config.ports.begin(); | 1289 for (relay_port = config.ports.begin(); |
1290 relay_port != config.ports.end(); ++relay_port) { | 1290 relay_port != config.ports.end(); ++relay_port) { |
1291 TurnPort* port = NULL; | 1291 TurnPort* port = NULL; |
1292 | 1292 |
1293 // Skip UDP connections to relay servers if it's disallowed. | 1293 // Skip UDP connections to relay servers if it's disallowed. |
1294 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP_RELAY) && | 1294 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP_RELAY) && |
1295 relay_port->proto == PROTO_UDP) { | 1295 relay_port->proto == PROTO_UDP) { |
1296 continue; | 1296 continue; |
1297 } | 1297 } |
1298 | 1298 |
| 1299 // Do not create a port if the server address family is known and does |
| 1300 // not match the local IP address family. |
| 1301 int server_ip_family = relay_port->address.ipaddr().family(); |
| 1302 int local_ip_family = ip_.family(); |
| 1303 if (server_ip_family != AF_UNSPEC && server_ip_family != local_ip_family) { |
| 1304 LOG(LS_INFO) << "Server and local address families are not compatible. " |
| 1305 << "Server address: " |
| 1306 << relay_port->address.ipaddr().ToString() |
| 1307 << " Local address: " << ip_.ToString(); |
| 1308 continue; |
| 1309 } |
| 1310 |
| 1311 |
1299 // Shared socket mode must be enabled only for UDP based ports. Hence | 1312 // Shared socket mode must be enabled only for UDP based ports. Hence |
1300 // don't pass shared socket for ports which will create TCP sockets. | 1313 // don't pass shared socket for ports which will create TCP sockets. |
1301 // TODO(mallinath) - Enable shared socket mode for TURN ports. Disabled | 1314 // TODO(mallinath) - Enable shared socket mode for TURN ports. Disabled |
1302 // due to webrtc bug https://code.google.com/p/webrtc/issues/detail?id=3537 | 1315 // due to webrtc bug https://code.google.com/p/webrtc/issues/detail?id=3537 |
1303 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && | 1316 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && |
1304 relay_port->proto == PROTO_UDP && udp_socket_) { | 1317 relay_port->proto == PROTO_UDP && udp_socket_) { |
1305 port = TurnPort::Create(session_->network_thread(), | 1318 port = TurnPort::Create(session_->network_thread(), |
1306 session_->socket_factory(), | 1319 session_->socket_factory(), |
1307 network_, udp_socket_.get(), | 1320 network_, udp_socket_.get(), |
1308 session_->username(), session_->password(), | 1321 session_->username(), session_->password(), |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 ServerAddresses servers; | 1460 ServerAddresses servers; |
1448 for (size_t i = 0; i < relays.size(); ++i) { | 1461 for (size_t i = 0; i < relays.size(); ++i) { |
1449 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { | 1462 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { |
1450 servers.insert(relays[i].ports.front().address); | 1463 servers.insert(relays[i].ports.front().address); |
1451 } | 1464 } |
1452 } | 1465 } |
1453 return servers; | 1466 return servers; |
1454 } | 1467 } |
1455 | 1468 |
1456 } // namespace cricket | 1469 } // namespace cricket |
OLD | NEW |