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

Side by Side Diff: webrtc/p2p/base/turnport.cc

Issue 2993403002: Support a user-provided string for the TLS ALPN extension.
Patch Set: Fix previous commit Created 3 years, 3 months 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/base/turnport.h ('k') | webrtc/p2p/base/turnport_unittest.cc » ('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 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 TurnPort::TurnPort(rtc::Thread* thread, 214 TurnPort::TurnPort(rtc::Thread* thread,
215 rtc::PacketSocketFactory* factory, 215 rtc::PacketSocketFactory* factory,
216 rtc::Network* network, 216 rtc::Network* network,
217 uint16_t min_port, 217 uint16_t min_port,
218 uint16_t max_port, 218 uint16_t max_port,
219 const std::string& username, 219 const std::string& username,
220 const std::string& password, 220 const std::string& password,
221 const ProtocolAddress& server_address, 221 const ProtocolAddress& server_address,
222 const RelayCredentials& credentials, 222 const RelayCredentials& credentials,
223 int server_priority, 223 int server_priority,
224 const std::string& origin) 224 const std::string& origin,
225 const std::vector<std::string>& tls_alpn_protocols)
225 : Port(thread, 226 : Port(thread,
226 RELAY_PORT_TYPE, 227 RELAY_PORT_TYPE,
227 factory, 228 factory,
228 network, 229 network,
229 min_port, 230 min_port,
230 max_port, 231 max_port,
231 username, 232 username,
232 password), 233 password),
233 server_address_(server_address), 234 server_address_(server_address),
235 tls_alpn_protocols_(tls_alpn_protocols),
234 credentials_(credentials), 236 credentials_(credentials),
235 socket_(NULL), 237 socket_(NULL),
236 resolver_(NULL), 238 resolver_(NULL),
237 error_(0), 239 error_(0),
238 request_manager_(thread), 240 request_manager_(thread),
239 next_channel_number_(TURN_CHANNEL_NUMBER_START), 241 next_channel_number_(TURN_CHANNEL_NUMBER_START),
240 state_(STATE_CONNECTING), 242 state_(STATE_CONNECTING),
241 server_priority_(server_priority), 243 server_priority_(server_priority),
242 allocate_mismatch_retries_(0) { 244 allocate_mismatch_retries_(0) {
243 request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket); 245 request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Apply server address TLS and insecure bits to options. 331 // Apply server address TLS and insecure bits to options.
330 if (server_address_.proto == PROTO_TLS) { 332 if (server_address_.proto == PROTO_TLS) {
331 if (tls_cert_policy_ == 333 if (tls_cert_policy_ ==
332 TlsCertPolicy::TLS_CERT_POLICY_INSECURE_NO_CHECK) { 334 TlsCertPolicy::TLS_CERT_POLICY_INSECURE_NO_CHECK) {
333 opts |= rtc::PacketSocketFactory::OPT_TLS_INSECURE; 335 opts |= rtc::PacketSocketFactory::OPT_TLS_INSECURE;
334 } else { 336 } else {
335 opts |= rtc::PacketSocketFactory::OPT_TLS; 337 opts |= rtc::PacketSocketFactory::OPT_TLS;
336 } 338 }
337 } 339 }
338 340
341 rtc::PacketSocketTcpOptions tcp_options;
342 tcp_options.opts = opts;
343 tcp_options.tls_alpn_protocols = tls_alpn_protocols_;
344 // rtc::PacketSocketTcpOptions tcp_options = {
345 // .opts = opts,
346 // .tls_alpn_protocols = tls_alpn_protocols_
347 // };
339 socket_ = socket_factory()->CreateClientTcpSocket( 348 socket_ = socket_factory()->CreateClientTcpSocket(
340 rtc::SocketAddress(Network()->GetBestIP(), 0), server_address_.address, 349 rtc::SocketAddress(Network()->GetBestIP(), 0), server_address_.address,
341 proxy(), user_agent(), opts); 350 proxy(), user_agent(), tcp_options);
342 } 351 }
343 352
344 if (!socket_) { 353 if (!socket_) {
345 error_ = SOCKET_ERROR; 354 error_ = SOCKET_ERROR;
346 return false; 355 return false;
347 } 356 }
348 357
349 // Apply options if any. 358 // Apply options if any.
350 for (SocketOptionsMap::iterator iter = socket_options_.begin(); 359 for (SocketOptionsMap::iterator iter = socket_options_.begin();
351 iter != socket_options_.end(); ++iter) { 360 iter != socket_options_.end(); ++iter) {
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 } else { 1602 } else {
1594 state_ = STATE_UNBOUND; 1603 state_ = STATE_UNBOUND;
1595 port_->FailAndPruneConnection(ext_addr_); 1604 port_->FailAndPruneConnection(ext_addr_);
1596 } 1605 }
1597 } 1606 }
1598 void TurnEntry::OnChannelBindTimeout() { 1607 void TurnEntry::OnChannelBindTimeout() {
1599 state_ = STATE_UNBOUND; 1608 state_ = STATE_UNBOUND;
1600 port_->FailAndPruneConnection(ext_addr_); 1609 port_->FailAndPruneConnection(ext_addr_);
1601 } 1610 }
1602 } // namespace cricket 1611 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnport.h ('k') | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698