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

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

Issue 192583004: QUIC - use QuicSessionKey tuple (host, port, is_https) instead of server_hostname (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with TOT Created 6 years, 9 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 | Annotate | Revision Log
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"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/quic/crypto/quic_server_info.h" 16 #include "net/quic/crypto/quic_server_info.h"
17 #include "net/quic/quic_connection_helper.h" 17 #include "net/quic/quic_connection_helper.h"
18 #include "net/quic/quic_crypto_client_stream_factory.h" 18 #include "net/quic/quic_crypto_client_stream_factory.h"
19 #include "net/quic/quic_default_packet_writer.h" 19 #include "net/quic/quic_default_packet_writer.h"
20 #include "net/quic/quic_session_key.h"
20 #include "net/quic/quic_stream_factory.h" 21 #include "net/quic/quic_stream_factory.h"
21 #include "net/ssl/ssl_info.h" 22 #include "net/ssl/ssl_info.h"
22 #include "net/udp/datagram_client_socket.h" 23 #include "net/udp/datagram_client_socket.h"
23 24
24 namespace net { 25 namespace net {
25 26
26 namespace { 27 namespace {
27 28
28 // Note: these values must be kept in sync with the corresponding values in: 29 // Note: these values must be kept in sync with the corresponding values in:
29 // tools/metrics/histograms/histograms.xml 30 // tools/metrics/histograms/histograms.xml
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ResetAndReturn(&callback_).Run(rv); 82 ResetAndReturn(&callback_).Run(rv);
82 } 83 }
83 84
84 QuicClientSession::QuicClientSession( 85 QuicClientSession::QuicClientSession(
85 QuicConnection* connection, 86 QuicConnection* connection,
86 scoped_ptr<DatagramClientSocket> socket, 87 scoped_ptr<DatagramClientSocket> socket,
87 scoped_ptr<QuicDefaultPacketWriter> writer, 88 scoped_ptr<QuicDefaultPacketWriter> writer,
88 QuicStreamFactory* stream_factory, 89 QuicStreamFactory* stream_factory,
89 scoped_ptr<QuicServerInfo> server_info, 90 scoped_ptr<QuicServerInfo> server_info,
90 QuicCryptoClientStreamFactory* crypto_client_stream_factory, 91 QuicCryptoClientStreamFactory* crypto_client_stream_factory,
91 const string& server_hostname, 92 const QuicSessionKey& server_key,
92 const QuicConfig& config, 93 const QuicConfig& config,
93 QuicCryptoClientConfig* crypto_config, 94 QuicCryptoClientConfig* crypto_config,
94 NetLog* net_log) 95 NetLog* net_log)
95 : QuicSession(connection, config), 96 : QuicSession(connection, config),
96 require_confirmation_(false), 97 require_confirmation_(false),
97 stream_factory_(stream_factory), 98 stream_factory_(stream_factory),
98 socket_(socket.Pass()), 99 socket_(socket.Pass()),
99 writer_(writer.Pass()), 100 writer_(writer.Pass()),
100 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 101 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
101 read_pending_(false), 102 read_pending_(false),
102 num_total_streams_(0), 103 num_total_streams_(0),
103 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 104 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
104 logger_(net_log_), 105 logger_(net_log_),
105 num_packets_read_(0), 106 num_packets_read_(0),
106 weak_factory_(this) { 107 weak_factory_(this) {
107 crypto_stream_.reset( 108 crypto_stream_.reset(
108 crypto_client_stream_factory ? 109 crypto_client_stream_factory ?
109 crypto_client_stream_factory->CreateQuicCryptoClientStream( 110 crypto_client_stream_factory->CreateQuicCryptoClientStream(
110 server_hostname, this, crypto_config) : 111 server_key, this, crypto_config) :
111 new QuicCryptoClientStream(server_hostname, this, crypto_config)); 112 new QuicCryptoClientStream(server_key, this, crypto_config));
112 113
113 crypto_stream_->SetQuicServerInfo(server_info.Pass()); 114 crypto_stream_->SetQuicServerInfo(server_info.Pass());
114 115
115 connection->set_debug_visitor(&logger_); 116 connection->set_debug_visitor(&logger_);
116 // TODO(rch): pass in full host port proxy pair 117 // TODO(rch): pass in full host port proxy pair
117 net_log_.BeginEvent( 118 net_log_.BeginEvent(
118 NetLog::TYPE_QUIC_SESSION, 119 NetLog::TYPE_QUIC_SESSION,
119 NetLog::StringCallback("host", &server_hostname)); 120 NetLog::StringCallback("host", &server_key.host()));
120 } 121 }
121 122
122 QuicClientSession::~QuicClientSession() { 123 QuicClientSession::~QuicClientSession() {
123 // The session must be closed before it is destroyed. 124 // The session must be closed before it is destroyed.
124 DCHECK(streams()->empty()); 125 DCHECK(streams()->empty());
125 CloseAllStreams(ERR_UNEXPECTED); 126 CloseAllStreams(ERR_UNEXPECTED);
126 DCHECK(observers_.empty()); 127 DCHECK(observers_.empty());
127 CloseAllObservers(ERR_UNEXPECTED); 128 CloseAllObservers(ERR_UNEXPECTED);
128 129
129 connection()->set_debug_visitor(NULL); 130 connection()->set_debug_visitor(NULL);
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 } 572 }
572 573
573 void QuicClientSession::NotifyFactoryOfSessionClosed() { 574 void QuicClientSession::NotifyFactoryOfSessionClosed() {
574 DCHECK_EQ(0u, GetNumOpenStreams()); 575 DCHECK_EQ(0u, GetNumOpenStreams());
575 // Will delete |this|. 576 // Will delete |this|.
576 if (stream_factory_) 577 if (stream_factory_)
577 stream_factory_->OnSessionClosed(this); 578 stream_factory_->OnSessionClosed(this);
578 } 579 }
579 580
580 } // namespace net 581 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698