Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1424803004: Revert of Adding the ability to change ICE servers through SetConfiguration. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/fakeportallocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 rtc::NetworkManager* network_manager, 97 rtc::NetworkManager* network_manager,
98 const ServerAddresses& stun_servers, 98 const ServerAddresses& stun_servers,
99 const rtc::SocketAddress& relay_address_udp, 99 const rtc::SocketAddress& relay_address_udp,
100 const rtc::SocketAddress& relay_address_tcp, 100 const rtc::SocketAddress& relay_address_tcp,
101 const rtc::SocketAddress& relay_address_ssl) 101 const rtc::SocketAddress& relay_address_ssl)
102 : network_manager_(network_manager), 102 : network_manager_(network_manager),
103 socket_factory_(NULL), 103 socket_factory_(NULL),
104 stun_servers_(stun_servers) { 104 stun_servers_(stun_servers) {
105 105
106 RelayServerConfig config(RELAY_GTURN); 106 RelayServerConfig config(RELAY_GTURN);
107 if (!relay_address_udp.IsNil()) { 107 if (!relay_address_udp.IsNil())
108 config.ports.push_back(ProtocolAddress(relay_address_udp, PROTO_UDP)); 108 config.ports.push_back(ProtocolAddress(relay_address_udp, PROTO_UDP));
109 } 109 if (!relay_address_tcp.IsNil())
110 if (!relay_address_tcp.IsNil()) {
111 config.ports.push_back(ProtocolAddress(relay_address_tcp, PROTO_TCP)); 110 config.ports.push_back(ProtocolAddress(relay_address_tcp, PROTO_TCP));
112 } 111 if (!relay_address_ssl.IsNil())
113 if (!relay_address_ssl.IsNil()) {
114 config.ports.push_back(ProtocolAddress(relay_address_ssl, PROTO_SSLTCP)); 112 config.ports.push_back(ProtocolAddress(relay_address_ssl, PROTO_SSLTCP));
115 }
116 113
117 if (!config.ports.empty()) { 114 if (!config.ports.empty())
118 AddTurnServer(config); 115 AddRelay(config);
119 }
120 116
121 Construct(); 117 Construct();
122 } 118 }
123 119
124 void BasicPortAllocator::Construct() { 120 void BasicPortAllocator::Construct() {
125 allow_tcp_listen_ = true; 121 allow_tcp_listen_ = true;
126 } 122 }
127 123
128 BasicPortAllocator::~BasicPortAllocator() { 124 BasicPortAllocator::~BasicPortAllocator() {
129 } 125 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 default: 234 default:
239 ASSERT(false); 235 ASSERT(false);
240 } 236 }
241 } 237 }
242 238
243 void BasicPortAllocatorSession::GetPortConfigurations() { 239 void BasicPortAllocatorSession::GetPortConfigurations() {
244 PortConfiguration* config = new PortConfiguration(allocator_->stun_servers(), 240 PortConfiguration* config = new PortConfiguration(allocator_->stun_servers(),
245 username(), 241 username(),
246 password()); 242 password());
247 243
248 for (const RelayServerConfig& turn_server : allocator_->turn_servers()) { 244 for (size_t i = 0; i < allocator_->relays().size(); ++i) {
249 config->AddRelay(turn_server); 245 config->AddRelay(allocator_->relays()[i]);
250 } 246 }
251 ConfigReady(config); 247 ConfigReady(config);
252 } 248 }
253 249
254 void BasicPortAllocatorSession::ConfigReady(PortConfiguration* config) { 250 void BasicPortAllocatorSession::ConfigReady(PortConfiguration* config) {
255 network_thread_->Post(this, MSG_CONFIG_READY, config); 251 network_thread_->Post(this, MSG_CONFIG_READY, config);
256 } 252 }
257 253
258 // Adds a configuration to the list. 254 // Adds a configuration to the list.
259 void BasicPortAllocatorSession::OnConfigReady(PortConfiguration* config) { 255 void BasicPortAllocatorSession::OnConfigReady(PortConfiguration* config) {
260 if (config) { 256 if (config)
261 configs_.push_back(config); 257 configs_.push_back(config);
262 }
263 258
264 AllocatePorts(); 259 AllocatePorts();
265 } 260 }
266 261
267 void BasicPortAllocatorSession::OnConfigStop() { 262 void BasicPortAllocatorSession::OnConfigStop() {
268 ASSERT(rtc::Thread::Current() == network_thread_); 263 ASSERT(rtc::Thread::Current() == network_thread_);
269 264
270 // If any of the allocated ports have not completed the candidates allocation, 265 // If any of the allocated ports have not completed the candidates allocation,
271 // mark those as error. Since session doesn't need any new candidates 266 // mark those as error. Since session doesn't need any new candidates
272 // at this stage of the allocation, it's safe to discard any new candidates. 267 // at this stage of the allocation, it's safe to discard any new candidates.
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 ServerAddresses servers; 1190 ServerAddresses servers;
1196 for (size_t i = 0; i < relays.size(); ++i) { 1191 for (size_t i = 0; i < relays.size(); ++i) {
1197 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1192 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1198 servers.insert(relays[i].ports.front().address); 1193 servers.insert(relays[i].ports.front().address);
1199 } 1194 }
1200 } 1195 }
1201 return servers; 1196 return servers;
1202 } 1197 }
1203 1198
1204 } // namespace cricket 1199 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/fakeportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698