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

Side by Side Diff: net/quic/quic_client_session.cc

Issue 429453003: Create a visitor which can allow using both a trace... visitor and the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Use_1350_byte_packet_71837432
Patch Set: fixed comments Created 6 years, 4 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 | « net/quic/quic_client_session.h ('k') | net/quic/quic_connection.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_client_session.h" 5 #include "net/quic/quic_client_session.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 require_confirmation_(false), 149 require_confirmation_(false),
150 stream_factory_(stream_factory), 150 stream_factory_(stream_factory),
151 socket_(socket.Pass()), 151 socket_(socket.Pass()),
152 writer_(writer.Pass()), 152 writer_(writer.Pass()),
153 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 153 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
154 server_info_(server_info.Pass()), 154 server_info_(server_info.Pass()),
155 read_pending_(false), 155 read_pending_(false),
156 num_total_streams_(0), 156 num_total_streams_(0),
157 task_runner_(task_runner), 157 task_runner_(task_runner),
158 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 158 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
159 logger_(net_log_), 159 logger_(new QuicConnectionLogger(net_log_)),
160 num_packets_read_(0), 160 num_packets_read_(0),
161 going_away_(false), 161 going_away_(false),
162 weak_factory_(this) { 162 weak_factory_(this) {
163 crypto_stream_.reset( 163 crypto_stream_.reset(
164 crypto_client_stream_factory ? 164 crypto_client_stream_factory ?
165 crypto_client_stream_factory->CreateQuicCryptoClientStream( 165 crypto_client_stream_factory->CreateQuicCryptoClientStream(
166 server_id, this, crypto_config) : 166 server_id, this, crypto_config) :
167 new QuicCryptoClientStream(server_id, this, 167 new QuicCryptoClientStream(server_id, this,
168 new ProofVerifyContextChromium(net_log_), 168 new ProofVerifyContextChromium(net_log_),
169 crypto_config)); 169 crypto_config));
170 170
171 connection->set_debug_visitor(&logger_); 171 connection->set_debug_visitor(logger_);
172 // TODO(rch): pass in full host port proxy pair 172 // TODO(rch): pass in full host port proxy pair
173 net_log_.BeginEvent( 173 net_log_.BeginEvent(
174 NetLog::TYPE_QUIC_SESSION, 174 NetLog::TYPE_QUIC_SESSION,
175 NetLog::StringCallback("host", &server_id.host())); 175 NetLog::StringCallback("host", &server_id.host()));
176 } 176 }
177 177
178 QuicClientSession::~QuicClientSession() { 178 QuicClientSession::~QuicClientSession() {
179 if (!streams()->empty()) 179 if (!streams()->empty())
180 RecordUnexpectedOpenStreams(DESTRUCTOR); 180 RecordUnexpectedOpenStreams(DESTRUCTOR);
181 if (!observers_.empty()) 181 if (!observers_.empty())
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 QuicDataStream* QuicClientSession::CreateIncomingDataStream( 510 QuicDataStream* QuicClientSession::CreateIncomingDataStream(
511 QuicStreamId id) { 511 QuicStreamId id) {
512 DLOG(ERROR) << "Server push not supported"; 512 DLOG(ERROR) << "Server push not supported";
513 return NULL; 513 return NULL;
514 } 514 }
515 515
516 void QuicClientSession::CloseStream(QuicStreamId stream_id) { 516 void QuicClientSession::CloseStream(QuicStreamId stream_id) {
517 ReliableQuicStream* stream = GetStream(stream_id); 517 ReliableQuicStream* stream = GetStream(stream_id);
518 if (stream) { 518 if (stream) {
519 logger_.UpdateReceivedFrameCounts( 519 logger_->UpdateReceivedFrameCounts(
520 stream_id, stream->num_frames_received(), 520 stream_id, stream->num_frames_received(),
521 stream->num_duplicate_frames_received()); 521 stream->num_duplicate_frames_received());
522 } 522 }
523 QuicSession::CloseStream(stream_id); 523 QuicSession::CloseStream(stream_id);
524 OnClosedStream(); 524 OnClosedStream();
525 } 525 }
526 526
527 void QuicClientSession::SendRstStream(QuicStreamId id, 527 void QuicClientSession::SendRstStream(QuicStreamId id,
528 QuicRstStreamErrorCode error, 528 QuicRstStreamErrorCode error,
529 QuicStreamOffset bytes_written) { 529 QuicStreamOffset bytes_written) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 Observer* observer = *it; 565 Observer* observer = *it;
566 ++it; 566 ++it;
567 observer->OnCryptoHandshakeConfirmed(); 567 observer->OnCryptoHandshakeConfirmed();
568 } 568 }
569 } 569 }
570 QuicSession::OnCryptoHandshakeEvent(event); 570 QuicSession::OnCryptoHandshakeEvent(event);
571 } 571 }
572 572
573 void QuicClientSession::OnCryptoHandshakeMessageSent( 573 void QuicClientSession::OnCryptoHandshakeMessageSent(
574 const CryptoHandshakeMessage& message) { 574 const CryptoHandshakeMessage& message) {
575 logger_.OnCryptoHandshakeMessageSent(message); 575 logger_->OnCryptoHandshakeMessageSent(message);
576 } 576 }
577 577
578 void QuicClientSession::OnCryptoHandshakeMessageReceived( 578 void QuicClientSession::OnCryptoHandshakeMessageReceived(
579 const CryptoHandshakeMessage& message) { 579 const CryptoHandshakeMessage& message) {
580 logger_.OnCryptoHandshakeMessageReceived(message); 580 logger_->OnCryptoHandshakeMessageReceived(message);
581 } 581 }
582 582
583 void QuicClientSession::OnConnectionClosed(QuicErrorCode error, 583 void QuicClientSession::OnConnectionClosed(QuicErrorCode error,
584 bool from_peer) { 584 bool from_peer) {
585 DCHECK(!connection()->connected()); 585 DCHECK(!connection()->connected());
586 logger_.OnConnectionClosed(error, from_peer); 586 logger_->OnConnectionClosed(error, from_peer);
587 if (from_peer) { 587 if (from_peer) {
588 UMA_HISTOGRAM_SPARSE_SLOWLY( 588 UMA_HISTOGRAM_SPARSE_SLOWLY(
589 "Net.QuicSession.ConnectionCloseErrorCodeServer", error); 589 "Net.QuicSession.ConnectionCloseErrorCodeServer", error);
590 } else { 590 } else {
591 UMA_HISTOGRAM_SPARSE_SLOWLY( 591 UMA_HISTOGRAM_SPARSE_SLOWLY(
592 "Net.QuicSession.ConnectionCloseErrorCodeClient", error); 592 "Net.QuicSession.ConnectionCloseErrorCodeClient", error);
593 } 593 }
594 594
595 if (error == QUIC_CONNECTION_TIMED_OUT) { 595 if (error == QUIC_CONNECTION_TIMED_OUT) {
596 UMA_HISTOGRAM_COUNTS( 596 UMA_HISTOGRAM_COUNTS(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 socket_->Close(); 631 socket_->Close();
632 QuicSession::OnConnectionClosed(error, from_peer); 632 QuicSession::OnConnectionClosed(error, from_peer);
633 DCHECK(streams()->empty()); 633 DCHECK(streams()->empty());
634 CloseAllStreams(ERR_UNEXPECTED); 634 CloseAllStreams(ERR_UNEXPECTED);
635 CloseAllObservers(ERR_UNEXPECTED); 635 CloseAllObservers(ERR_UNEXPECTED);
636 NotifyFactoryOfSessionClosedLater(); 636 NotifyFactoryOfSessionClosedLater();
637 } 637 }
638 638
639 void QuicClientSession::OnSuccessfulVersionNegotiation( 639 void QuicClientSession::OnSuccessfulVersionNegotiation(
640 const QuicVersion& version) { 640 const QuicVersion& version) {
641 logger_.OnSuccessfulVersionNegotiation(version); 641 logger_->OnSuccessfulVersionNegotiation(version);
642 QuicSession::OnSuccessfulVersionNegotiation(version); 642 QuicSession::OnSuccessfulVersionNegotiation(version);
643 } 643 }
644 644
645 void QuicClientSession::OnProofValid( 645 void QuicClientSession::OnProofValid(
646 const QuicCryptoClientConfig::CachedState& cached) { 646 const QuicCryptoClientConfig::CachedState& cached) {
647 DCHECK(cached.proof_valid()); 647 DCHECK(cached.proof_valid());
648 648
649 if (!server_info_ || !server_info_->IsReadyToPersist()) { 649 if (!server_info_ || !server_info_->IsReadyToPersist()) {
650 return; 650 return;
651 } 651 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 return; 850 return;
851 851
852 // TODO(rch): re-enable this code once beta is cut. 852 // TODO(rch): re-enable this code once beta is cut.
853 // if (stream_factory_) 853 // if (stream_factory_)
854 // stream_factory_->OnSessionConnectTimeout(this); 854 // stream_factory_->OnSessionConnectTimeout(this);
855 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 855 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
856 // DCHECK_EQ(0u, GetNumOpenStreams()); 856 // DCHECK_EQ(0u, GetNumOpenStreams());
857 } 857 }
858 858
859 } // namespace net 859 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698