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

Side by Side Diff: webrtc/p2p/quic/quictransportchannel.cc

Issue 1856513002: Add QuicTransportChannel methods for QUIC streams (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 : net::Perspective::IS_SERVER; 436 : net::Perspective::IS_SERVER;
437 bool owns_writer = false; 437 bool owns_writer = false;
438 rtc::scoped_ptr<net::QuicConnection> connection(new net::QuicConnection( 438 rtc::scoped_ptr<net::QuicConnection> connection(new net::QuicConnection(
439 kConnectionId, kConnectionIpEndpoint, &helper_, this, owns_writer, 439 kConnectionId, kConnectionIpEndpoint, &helper_, this, owns_writer,
440 perspective, net::QuicSupportedVersions())); 440 perspective, net::QuicSupportedVersions()));
441 quic_.reset(new QuicSession(std::move(connection), config_)); 441 quic_.reset(new QuicSession(std::move(connection), config_));
442 quic_->SignalHandshakeComplete.connect( 442 quic_->SignalHandshakeComplete.connect(
443 this, &QuicTransportChannel::OnHandshakeComplete); 443 this, &QuicTransportChannel::OnHandshakeComplete);
444 quic_->SignalConnectionClosed.connect( 444 quic_->SignalConnectionClosed.connect(
445 this, &QuicTransportChannel::OnConnectionClosed); 445 this, &QuicTransportChannel::OnConnectionClosed);
446 quic_->SignalIncomingStream.connect(this,
447 &QuicTransportChannel::OnIncomingStream);
446 return true; 448 return true;
447 } 449 }
448 450
449 bool QuicTransportChannel::StartQuicHandshake() { 451 bool QuicTransportChannel::StartQuicHandshake() {
450 if (*ssl_role_ == rtc::SSL_CLIENT) { 452 if (*ssl_role_ == rtc::SSL_CLIENT) {
451 // Unique identifier for remote peer. 453 // Unique identifier for remote peer.
452 net::QuicServerId server_id(remote_fingerprint_->value, kQuicServerPort); 454 net::QuicServerId server_id(remote_fingerprint_->value, kQuicServerPort);
453 // Perform authentication of remote peer; owned by QuicCryptoClientConfig. 455 // Perform authentication of remote peer; owned by QuicCryptoClientConfig.
454 // TODO(mikescarlett): Actually verify proof. 456 // TODO(mikescarlett): Actually verify proof.
455 net::ProofVerifier* proof_verifier = new InsecureProofVerifier(); 457 net::ProofVerifier* proof_verifier = new InsecureProofVerifier();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 536
535 void QuicTransportChannel::OnConnectionClosed(net::QuicErrorCode error, 537 void QuicTransportChannel::OnConnectionClosed(net::QuicErrorCode error,
536 bool from_peer) { 538 bool from_peer) {
537 LOG_J(LS_INFO, this) << "Connection closed by " 539 LOG_J(LS_INFO, this) << "Connection closed by "
538 << (from_peer ? "other" : "this") << " peer " 540 << (from_peer ? "other" : "this") << " peer "
539 << "with QUIC error " << error; 541 << "with QUIC error " << error;
540 // TODO(mikescarlett): Allow the QUIC session to be reset when the connection 542 // TODO(mikescarlett): Allow the QUIC session to be reset when the connection
541 // does not close due to failure. 543 // does not close due to failure.
542 set_quic_state(QUIC_TRANSPORT_CLOSED); 544 set_quic_state(QUIC_TRANSPORT_CLOSED);
543 set_writable(false); 545 set_writable(false);
546 SignalClosed();
544 } 547 }
545 548
546 void QuicTransportChannel::OnProofValid( 549 void QuicTransportChannel::OnProofValid(
547 const net::QuicCryptoClientConfig::CachedState& cached) { 550 const net::QuicCryptoClientConfig::CachedState& cached) {
548 LOG_J(LS_INFO, this) << "Cached proof marked valid"; 551 LOG_J(LS_INFO, this) << "Cached proof marked valid";
549 } 552 }
550 553
551 void QuicTransportChannel::OnProofVerifyDetailsAvailable( 554 void QuicTransportChannel::OnProofVerifyDetailsAvailable(
552 const net::ProofVerifyDetails& verify_details) { 555 const net::ProofVerifyDetails& verify_details) {
553 LOG_J(LS_INFO, this) << "Proof verify details available from" 556 LOG_J(LS_INFO, this) << "Proof verify details available from"
554 << " QuicCryptoClientStream"; 557 << " QuicCryptoClientStream";
555 } 558 }
556 559
557 bool QuicTransportChannel::HasDataToWrite() const { 560 bool QuicTransportChannel::HasDataToWrite() const {
558 return quic_ && quic_->HasDataToWrite(); 561 return quic_ && quic_->HasDataToWrite();
559 } 562 }
560 563
561 void QuicTransportChannel::OnCanWrite() { 564 void QuicTransportChannel::OnCanWrite() {
562 RTC_DCHECK(quic_ != nullptr); 565 RTC_DCHECK(quic_ != nullptr);
563 quic_->connection()->OnCanWrite(); 566 quic_->connection()->OnCanWrite();
564 } 567 }
565 568
566 void QuicTransportChannel::set_quic_state(QuicTransportState state) { 569 void QuicTransportChannel::set_quic_state(QuicTransportState state) {
567 LOG_J(LS_VERBOSE, this) << "set_quic_state from:" << quic_state_ << " to " 570 LOG_J(LS_VERBOSE, this) << "set_quic_state from:" << quic_state_ << " to "
568 << state; 571 << state;
569 quic_state_ = state; 572 quic_state_ = state;
570 } 573 }
571 574
575 ReliableQuicStream* QuicTransportChannel::CreateQuicStream() {
576 if (quic_) {
577 net::SpdyPriority priority = 0; // Priority of the QUIC stream (not used)
578 return quic_->CreateOutgoingDynamicStream(priority);
579 }
580 return nullptr;
581 }
582
583 void QuicTransportChannel::OnIncomingStream(ReliableQuicStream* stream) {
584 SignalIncomingStream(stream);
585 }
586
572 } // namespace cricket 587 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698