| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager) | 107 BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager) |
| 108 : network_manager_(network_manager), socket_factory_(nullptr) { | 108 : network_manager_(network_manager), socket_factory_(nullptr) { |
| 109 RTC_DCHECK(network_manager_ != nullptr); | 109 RTC_DCHECK(network_manager_ != nullptr); |
| 110 Construct(); | 110 Construct(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager, | 113 BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager, |
| 114 rtc::PacketSocketFactory* socket_factory, | 114 rtc::PacketSocketFactory* socket_factory, |
| 115 const ServerAddresses& stun_servers) | 115 const ServerAddresses& stun_servers) |
| 116 : network_manager_(network_manager), socket_factory_(socket_factory) { | 116 : network_manager_(network_manager), socket_factory_(socket_factory) { |
| 117 RTC_DCHECK(socket_factory_ != NULL); | 117 RTC_DCHECK(socket_factory_ != nullptr); |
| 118 SetConfiguration(stun_servers, std::vector<RelayServerConfig>(), 0, false); | 118 SetConfiguration(stun_servers, std::vector<RelayServerConfig>(), 0, false); |
| 119 Construct(); | 119 Construct(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 BasicPortAllocator::BasicPortAllocator( | 122 BasicPortAllocator::BasicPortAllocator( |
| 123 rtc::NetworkManager* network_manager, | 123 rtc::NetworkManager* network_manager, |
| 124 const ServerAddresses& stun_servers, | 124 const ServerAddresses& stun_servers, |
| 125 const rtc::SocketAddress& relay_address_udp, | 125 const rtc::SocketAddress& relay_address_udp, |
| 126 const rtc::SocketAddress& relay_address_tcp, | 126 const rtc::SocketAddress& relay_address_tcp, |
| 127 const rtc::SocketAddress& relay_address_ssl) | 127 const rtc::SocketAddress& relay_address_ssl) |
| 128 : network_manager_(network_manager), socket_factory_(NULL) { | 128 : network_manager_(network_manager), socket_factory_(nullptr) { |
| 129 std::vector<RelayServerConfig> turn_servers; | 129 std::vector<RelayServerConfig> turn_servers; |
| 130 RelayServerConfig config(RELAY_GTURN); | 130 RelayServerConfig config(RELAY_GTURN); |
| 131 if (!relay_address_udp.IsNil()) { | 131 if (!relay_address_udp.IsNil()) { |
| 132 config.ports.push_back(ProtocolAddress(relay_address_udp, PROTO_UDP)); | 132 config.ports.push_back(ProtocolAddress(relay_address_udp, PROTO_UDP)); |
| 133 } | 133 } |
| 134 if (!relay_address_tcp.IsNil()) { | 134 if (!relay_address_tcp.IsNil()) { |
| 135 config.ports.push_back(ProtocolAddress(relay_address_tcp, PROTO_TCP)); | 135 config.ports.push_back(ProtocolAddress(relay_address_tcp, PROTO_TCP)); |
| 136 } | 136 } |
| 137 if (!relay_address_ssl.IsNil()) { | 137 if (!relay_address_ssl.IsNil()) { |
| 138 config.ports.push_back(ProtocolAddress(relay_address_ssl, PROTO_SSLTCP)); | 138 config.ports.push_back(ProtocolAddress(relay_address_ssl, PROTO_SSLTCP)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const std::string& content_name, | 194 const std::string& content_name, |
| 195 int component, | 195 int component, |
| 196 const std::string& ice_ufrag, | 196 const std::string& ice_ufrag, |
| 197 const std::string& ice_pwd) | 197 const std::string& ice_pwd) |
| 198 : PortAllocatorSession(content_name, | 198 : PortAllocatorSession(content_name, |
| 199 component, | 199 component, |
| 200 ice_ufrag, | 200 ice_ufrag, |
| 201 ice_pwd, | 201 ice_pwd, |
| 202 allocator->flags()), | 202 allocator->flags()), |
| 203 allocator_(allocator), | 203 allocator_(allocator), |
| 204 network_thread_(NULL), | 204 network_thread_(nullptr), |
| 205 socket_factory_(allocator->socket_factory()), | 205 socket_factory_(allocator->socket_factory()), |
| 206 allocation_started_(false), | 206 allocation_started_(false), |
| 207 network_manager_started_(false), | 207 network_manager_started_(false), |
| 208 allocation_sequences_created_(false), | 208 allocation_sequences_created_(false), |
| 209 prune_turn_ports_(allocator->prune_turn_ports()) { | 209 prune_turn_ports_(allocator->prune_turn_ports()) { |
| 210 allocator_->network_manager()->SignalNetworksChanged.connect( | 210 allocator_->network_manager()->SignalNetworksChanged.connect( |
| 211 this, &BasicPortAllocatorSession::OnNetworksChanged); | 211 this, &BasicPortAllocatorSession::OnNetworksChanged); |
| 212 allocator_->network_manager()->StartUpdating(); | 212 allocator_->network_manager()->StartUpdating(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 BasicPortAllocatorSession::~BasicPortAllocatorSession() { | 215 BasicPortAllocatorSession::~BasicPortAllocatorSession() { |
| 216 allocator_->network_manager()->StopUpdating(); | 216 allocator_->network_manager()->StopUpdating(); |
| 217 if (network_thread_ != NULL) | 217 if (network_thread_ != nullptr) |
| 218 network_thread_->Clear(this); | 218 network_thread_->Clear(this); |
| 219 | 219 |
| 220 for (uint32_t i = 0; i < sequences_.size(); ++i) { | 220 for (uint32_t i = 0; i < sequences_.size(); ++i) { |
| 221 // AllocationSequence should clear it's map entry for turn ports before | 221 // AllocationSequence should clear it's map entry for turn ports before |
| 222 // ports are destroyed. | 222 // ports are destroyed. |
| 223 sequences_[i]->Clear(); | 223 sequences_[i]->Clear(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 std::vector<PortData>::iterator it; | 226 std::vector<PortData>::iterator it; |
| 227 for (it = ports_.begin(); it != ports_.end(); it++) | 227 for (it = ports_.begin(); it != ports_.end(); it++) |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 void BasicPortAllocatorSession::OnAllocationSequenceObjectsCreated() { | 714 void BasicPortAllocatorSession::OnAllocationSequenceObjectsCreated() { |
| 715 allocation_sequences_created_ = true; | 715 allocation_sequences_created_ = true; |
| 716 // Send candidate allocation complete signal if we have no sequences. | 716 // Send candidate allocation complete signal if we have no sequences. |
| 717 MaybeSignalCandidatesAllocationDone(); | 717 MaybeSignalCandidatesAllocationDone(); |
| 718 } | 718 } |
| 719 | 719 |
| 720 void BasicPortAllocatorSession::OnCandidateReady( | 720 void BasicPortAllocatorSession::OnCandidateReady( |
| 721 Port* port, const Candidate& c) { | 721 Port* port, const Candidate& c) { |
| 722 RTC_DCHECK(rtc::Thread::Current() == network_thread_); | 722 RTC_DCHECK(rtc::Thread::Current() == network_thread_); |
| 723 PortData* data = FindPort(port); | 723 PortData* data = FindPort(port); |
| 724 RTC_DCHECK(data != NULL); | 724 RTC_DCHECK(data != nullptr); |
| 725 LOG_J(LS_INFO, port) << "Gathered candidate: " << c.ToSensitiveString(); | 725 LOG_J(LS_INFO, port) << "Gathered candidate: " << c.ToSensitiveString(); |
| 726 // Discarding any candidate signal if port allocation status is | 726 // Discarding any candidate signal if port allocation status is |
| 727 // already done with gathering. | 727 // already done with gathering. |
| 728 if (!data->inprogress()) { | 728 if (!data->inprogress()) { |
| 729 LOG(LS_WARNING) | 729 LOG(LS_WARNING) |
| 730 << "Discarding candidate because port is already done gathering."; | 730 << "Discarding candidate because port is already done gathering."; |
| 731 return; | 731 return; |
| 732 } | 732 } |
| 733 | 733 |
| 734 // Mark that the port has a pairable candidate, either because we have a | 734 // Mark that the port has a pairable candidate, either because we have a |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 void BasicPortAllocatorSession::PruneAllPorts() { | 826 void BasicPortAllocatorSession::PruneAllPorts() { |
| 827 for (PortData& data : ports_) { | 827 for (PortData& data : ports_) { |
| 828 data.Prune(); | 828 data.Prune(); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 | 831 |
| 832 void BasicPortAllocatorSession::OnPortComplete(Port* port) { | 832 void BasicPortAllocatorSession::OnPortComplete(Port* port) { |
| 833 RTC_DCHECK(rtc::Thread::Current() == network_thread_); | 833 RTC_DCHECK(rtc::Thread::Current() == network_thread_); |
| 834 LOG_J(LS_INFO, port) << "Port completed gathering candidates."; | 834 LOG_J(LS_INFO, port) << "Port completed gathering candidates."; |
| 835 PortData* data = FindPort(port); | 835 PortData* data = FindPort(port); |
| 836 RTC_DCHECK(data != NULL); | 836 RTC_DCHECK(data != nullptr); |
| 837 | 837 |
| 838 // Ignore any late signals. | 838 // Ignore any late signals. |
| 839 if (!data->inprogress()) { | 839 if (!data->inprogress()) { |
| 840 return; | 840 return; |
| 841 } | 841 } |
| 842 | 842 |
| 843 // Moving to COMPLETE state. | 843 // Moving to COMPLETE state. |
| 844 data->set_complete(); | 844 data->set_complete(); |
| 845 // Send candidate allocation complete signal if this was the last port. | 845 // Send candidate allocation complete signal if this was the last port. |
| 846 MaybeSignalCandidatesAllocationDone(); | 846 MaybeSignalCandidatesAllocationDone(); |
| 847 } | 847 } |
| 848 | 848 |
| 849 void BasicPortAllocatorSession::OnPortError(Port* port) { | 849 void BasicPortAllocatorSession::OnPortError(Port* port) { |
| 850 RTC_DCHECK(rtc::Thread::Current() == network_thread_); | 850 RTC_DCHECK(rtc::Thread::Current() == network_thread_); |
| 851 LOG_J(LS_INFO, port) << "Port encountered error while gathering candidates."; | 851 LOG_J(LS_INFO, port) << "Port encountered error while gathering candidates."; |
| 852 PortData* data = FindPort(port); | 852 PortData* data = FindPort(port); |
| 853 RTC_DCHECK(data != NULL); | 853 RTC_DCHECK(data != nullptr); |
| 854 // We might have already given up on this port and stopped it. | 854 // We might have already given up on this port and stopped it. |
| 855 if (!data->inprogress()) { | 855 if (!data->inprogress()) { |
| 856 return; | 856 return; |
| 857 } | 857 } |
| 858 | 858 |
| 859 // SignalAddressError is currently sent from StunPort/TurnPort. | 859 // SignalAddressError is currently sent from StunPort/TurnPort. |
| 860 // But this signal itself is generic. | 860 // But this signal itself is generic. |
| 861 data->set_error(); | 861 data->set_error(); |
| 862 // Send candidate allocation complete signal if this was the last port. | 862 // Send candidate allocation complete signal if this was the last port. |
| 863 MaybeSignalCandidatesAllocationDone(); | 863 MaybeSignalCandidatesAllocationDone(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 } | 978 } |
| 979 | 979 |
| 980 BasicPortAllocatorSession::PortData* BasicPortAllocatorSession::FindPort( | 980 BasicPortAllocatorSession::PortData* BasicPortAllocatorSession::FindPort( |
| 981 Port* port) { | 981 Port* port) { |
| 982 for (std::vector<PortData>::iterator it = ports_.begin(); | 982 for (std::vector<PortData>::iterator it = ports_.begin(); |
| 983 it != ports_.end(); ++it) { | 983 it != ports_.end(); ++it) { |
| 984 if (it->port() == port) { | 984 if (it->port() == port) { |
| 985 return &*it; | 985 return &*it; |
| 986 } | 986 } |
| 987 } | 987 } |
| 988 return NULL; | 988 return nullptr; |
| 989 } | 989 } |
| 990 | 990 |
| 991 std::vector<BasicPortAllocatorSession::PortData*> | 991 std::vector<BasicPortAllocatorSession::PortData*> |
| 992 BasicPortAllocatorSession::GetUnprunedPorts( | 992 BasicPortAllocatorSession::GetUnprunedPorts( |
| 993 const std::vector<rtc::Network*>& networks) { | 993 const std::vector<rtc::Network*>& networks) { |
| 994 std::vector<PortData*> unpruned_ports; | 994 std::vector<PortData*> unpruned_ports; |
| 995 for (PortData& port : ports_) { | 995 for (PortData& port : ports_) { |
| 996 if (!port.pruned() && | 996 if (!port.pruned() && |
| 997 std::find(networks.begin(), networks.end(), | 997 std::find(networks.begin(), networks.end(), |
| 998 port.sequence()->network()) != networks.end()) { | 998 port.sequence()->network()) != networks.end()) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 rtc::Network* network, | 1032 rtc::Network* network, |
| 1033 PortConfiguration* config, | 1033 PortConfiguration* config, |
| 1034 uint32_t flags) | 1034 uint32_t flags) |
| 1035 : session_(session), | 1035 : session_(session), |
| 1036 network_(network), | 1036 network_(network), |
| 1037 ip_(network->GetBestIP()), | 1037 ip_(network->GetBestIP()), |
| 1038 config_(config), | 1038 config_(config), |
| 1039 state_(kInit), | 1039 state_(kInit), |
| 1040 flags_(flags), | 1040 flags_(flags), |
| 1041 udp_socket_(), | 1041 udp_socket_(), |
| 1042 udp_port_(NULL), | 1042 udp_port_(nullptr), |
| 1043 phase_(0) { | 1043 phase_(0) {} |
| 1044 } | |
| 1045 | 1044 |
| 1046 void AllocationSequence::Init() { | 1045 void AllocationSequence::Init() { |
| 1047 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) { | 1046 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) { |
| 1048 udp_socket_.reset(session_->socket_factory()->CreateUdpSocket( | 1047 udp_socket_.reset(session_->socket_factory()->CreateUdpSocket( |
| 1049 rtc::SocketAddress(ip_, 0), session_->allocator()->min_port(), | 1048 rtc::SocketAddress(ip_, 0), session_->allocator()->min_port(), |
| 1050 session_->allocator()->max_port())); | 1049 session_->allocator()->max_port())); |
| 1051 if (udp_socket_) { | 1050 if (udp_socket_) { |
| 1052 udp_socket_->SignalReadPacket.connect( | 1051 udp_socket_->SignalReadPacket.connect( |
| 1053 this, &AllocationSequence::OnReadPacket); | 1052 this, &AllocationSequence::OnReadPacket); |
| 1054 } | 1053 } |
| 1055 // Continuing if |udp_socket_| is NULL, as local TCP and RelayPort using TCP | 1054 // Continuing if |udp_socket_| is null, as local TCP and RelayPort using TCP |
| 1056 // are next available options to setup a communication channel. | 1055 // are next available options to setup a communication channel. |
| 1057 } | 1056 } |
| 1058 } | 1057 } |
| 1059 | 1058 |
| 1060 void AllocationSequence::Clear() { | 1059 void AllocationSequence::Clear() { |
| 1061 udp_port_ = NULL; | 1060 udp_port_ = nullptr; |
| 1062 turn_ports_.clear(); | 1061 turn_ports_.clear(); |
| 1063 } | 1062 } |
| 1064 | 1063 |
| 1065 void AllocationSequence::OnNetworkFailed() { | 1064 void AllocationSequence::OnNetworkFailed() { |
| 1066 RTC_DCHECK(!network_failed_); | 1065 RTC_DCHECK(!network_failed_); |
| 1067 network_failed_ = true; | 1066 network_failed_ = true; |
| 1068 // Stop the allocation sequence if its network failed. | 1067 // Stop the allocation sequence if its network failed. |
| 1069 Stop(); | 1068 Stop(); |
| 1070 } | 1069 } |
| 1071 | 1070 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 } | 1187 } |
| 1189 | 1188 |
| 1190 void AllocationSequence::CreateUDPPorts() { | 1189 void AllocationSequence::CreateUDPPorts() { |
| 1191 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP)) { | 1190 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP)) { |
| 1192 LOG(LS_VERBOSE) << "AllocationSequence: UDP ports disabled, skipping."; | 1191 LOG(LS_VERBOSE) << "AllocationSequence: UDP ports disabled, skipping."; |
| 1193 return; | 1192 return; |
| 1194 } | 1193 } |
| 1195 | 1194 |
| 1196 // TODO(mallinath) - Remove UDPPort creating socket after shared socket | 1195 // TODO(mallinath) - Remove UDPPort creating socket after shared socket |
| 1197 // is enabled completely. | 1196 // is enabled completely. |
| 1198 UDPPort* port = NULL; | 1197 UDPPort* port = nullptr; |
| 1199 bool emit_local_candidate_for_anyaddress = | 1198 bool emit_local_candidate_for_anyaddress = |
| 1200 !IsFlagSet(PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE); | 1199 !IsFlagSet(PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE); |
| 1201 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && udp_socket_) { | 1200 if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && udp_socket_) { |
| 1202 port = UDPPort::Create( | 1201 port = UDPPort::Create( |
| 1203 session_->network_thread(), session_->socket_factory(), network_, | 1202 session_->network_thread(), session_->socket_factory(), network_, |
| 1204 udp_socket_.get(), session_->username(), session_->password(), | 1203 udp_socket_.get(), session_->username(), session_->password(), |
| 1205 session_->allocator()->origin(), emit_local_candidate_for_anyaddress); | 1204 session_->allocator()->origin(), emit_local_candidate_for_anyaddress); |
| 1206 } else { | 1205 } else { |
| 1207 port = UDPPort::Create( | 1206 port = UDPPort::Create( |
| 1208 session_->network_thread(), session_->socket_factory(), network_, ip_, | 1207 session_->network_thread(), session_->socket_factory(), network_, ip_, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 } | 1336 } |
| 1338 // Start fetching an address for this port. | 1337 // Start fetching an address for this port. |
| 1339 port->PrepareAddress(); | 1338 port->PrepareAddress(); |
| 1340 } | 1339 } |
| 1341 } | 1340 } |
| 1342 | 1341 |
| 1343 void AllocationSequence::CreateTurnPort(const RelayServerConfig& config) { | 1342 void AllocationSequence::CreateTurnPort(const RelayServerConfig& config) { |
| 1344 PortList::const_iterator relay_port; | 1343 PortList::const_iterator relay_port; |
| 1345 for (relay_port = config.ports.begin(); | 1344 for (relay_port = config.ports.begin(); |
| 1346 relay_port != config.ports.end(); ++relay_port) { | 1345 relay_port != config.ports.end(); ++relay_port) { |
| 1347 TurnPort* port = NULL; | 1346 TurnPort* port = nullptr; |
| 1348 | 1347 |
| 1349 // Skip UDP connections to relay servers if it's disallowed. | 1348 // Skip UDP connections to relay servers if it's disallowed. |
| 1350 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP_RELAY) && | 1349 if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP_RELAY) && |
| 1351 relay_port->proto == PROTO_UDP) { | 1350 relay_port->proto == PROTO_UDP) { |
| 1352 continue; | 1351 continue; |
| 1353 } | 1352 } |
| 1354 | 1353 |
| 1355 // Do not create a port if the server address family is known and does | 1354 // Do not create a port if the server address family is known and does |
| 1356 // not match the local IP address family. | 1355 // not match the local IP address family. |
| 1357 int server_ip_family = relay_port->address.ipaddr().family(); | 1356 int server_ip_family = relay_port->address.ipaddr().family(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1385 port = TurnPort::Create(session_->network_thread(), | 1384 port = TurnPort::Create(session_->network_thread(), |
| 1386 session_->socket_factory(), | 1385 session_->socket_factory(), |
| 1387 network_, ip_, | 1386 network_, ip_, |
| 1388 session_->allocator()->min_port(), | 1387 session_->allocator()->min_port(), |
| 1389 session_->allocator()->max_port(), | 1388 session_->allocator()->max_port(), |
| 1390 session_->username(), | 1389 session_->username(), |
| 1391 session_->password(), | 1390 session_->password(), |
| 1392 *relay_port, config.credentials, config.priority, | 1391 *relay_port, config.credentials, config.priority, |
| 1393 session_->allocator()->origin()); | 1392 session_->allocator()->origin()); |
| 1394 } | 1393 } |
| 1395 RTC_DCHECK(port != NULL); | 1394 RTC_DCHECK(port != nullptr); |
| 1396 port->SetTlsCertPolicy(config.tls_cert_policy); | 1395 port->SetTlsCertPolicy(config.tls_cert_policy); |
| 1397 session_->AddAllocatedPort(port, this, true); | 1396 session_->AddAllocatedPort(port, this, true); |
| 1398 } | 1397 } |
| 1399 } | 1398 } |
| 1400 | 1399 |
| 1401 void AllocationSequence::OnReadPacket( | 1400 void AllocationSequence::OnReadPacket( |
| 1402 rtc::AsyncPacketSocket* socket, const char* data, size_t size, | 1401 rtc::AsyncPacketSocket* socket, const char* data, size_t size, |
| 1403 const rtc::SocketAddress& remote_addr, | 1402 const rtc::SocketAddress& remote_addr, |
| 1404 const rtc::PacketTime& packet_time) { | 1403 const rtc::PacketTime& packet_time) { |
| 1405 RTC_DCHECK(socket == udp_socket_.get()); | 1404 RTC_DCHECK(socket == udp_socket_.get()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1431 stun_servers.find(remote_addr) != stun_servers.end()) { | 1430 stun_servers.find(remote_addr) != stun_servers.end()) { |
| 1432 RTC_DCHECK(udp_port_->SharedSocket()); | 1431 RTC_DCHECK(udp_port_->SharedSocket()); |
| 1433 udp_port_->HandleIncomingPacket(socket, data, size, remote_addr, | 1432 udp_port_->HandleIncomingPacket(socket, data, size, remote_addr, |
| 1434 packet_time); | 1433 packet_time); |
| 1435 } | 1434 } |
| 1436 } | 1435 } |
| 1437 } | 1436 } |
| 1438 | 1437 |
| 1439 void AllocationSequence::OnPortDestroyed(PortInterface* port) { | 1438 void AllocationSequence::OnPortDestroyed(PortInterface* port) { |
| 1440 if (udp_port_ == port) { | 1439 if (udp_port_ == port) { |
| 1441 udp_port_ = NULL; | 1440 udp_port_ = nullptr; |
| 1442 return; | 1441 return; |
| 1443 } | 1442 } |
| 1444 | 1443 |
| 1445 auto it = std::find(turn_ports_.begin(), turn_ports_.end(), port); | 1444 auto it = std::find(turn_ports_.begin(), turn_ports_.end(), port); |
| 1446 if (it != turn_ports_.end()) { | 1445 if (it != turn_ports_.end()) { |
| 1447 turn_ports_.erase(it); | 1446 turn_ports_.erase(it); |
| 1448 } else { | 1447 } else { |
| 1449 LOG(LS_ERROR) << "Unexpected OnPortDestroyed for nonexistent port."; | 1448 LOG(LS_ERROR) << "Unexpected OnPortDestroyed for nonexistent port."; |
| 1450 RTC_NOTREACHED(); | 1449 RTC_NOTREACHED(); |
| 1451 } | 1450 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 ServerAddresses servers; | 1516 ServerAddresses servers; |
| 1518 for (size_t i = 0; i < relays.size(); ++i) { | 1517 for (size_t i = 0; i < relays.size(); ++i) { |
| 1519 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { | 1518 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { |
| 1520 servers.insert(relays[i].ports.front().address); | 1519 servers.insert(relays[i].ports.front().address); |
| 1521 } | 1520 } |
| 1522 } | 1521 } |
| 1523 return servers; | 1522 return servers; |
| 1524 } | 1523 } |
| 1525 | 1524 |
| 1526 } // namespace cricket | 1525 } // namespace cricket |
| OLD | NEW |