OLD | NEW |
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/proof_verifier_chromium.h" | 16 #include "net/quic/crypto/proof_verifier_chromium.h" |
17 #include "net/quic/crypto/quic_server_info.h" | 17 #include "net/quic/crypto/quic_server_info.h" |
18 #include "net/quic/quic_connection_helper.h" | 18 #include "net/quic/quic_connection_helper.h" |
19 #include "net/quic/quic_crypto_client_stream_factory.h" | 19 #include "net/quic/quic_crypto_client_stream_factory.h" |
20 #include "net/quic/quic_default_packet_writer.h" | |
21 #include "net/quic/quic_server_id.h" | 20 #include "net/quic/quic_server_id.h" |
22 #include "net/quic/quic_stream_factory.h" | 21 #include "net/quic/quic_stream_factory.h" |
23 #include "net/ssl/channel_id_service.h" | 22 #include "net/ssl/channel_id_service.h" |
24 #include "net/ssl/ssl_connection_status_flags.h" | 23 #include "net/ssl/ssl_connection_status_flags.h" |
25 #include "net/ssl/ssl_info.h" | 24 #include "net/ssl/ssl_info.h" |
26 #include "net/udp/datagram_client_socket.h" | 25 #include "net/udp/datagram_client_socket.h" |
27 | 26 |
28 namespace net { | 27 namespace net { |
29 | 28 |
30 namespace { | 29 namespace { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 127 } |
129 | 128 |
130 void QuicClientSession::StreamRequest::OnRequestCompleteFailure(int rv) { | 129 void QuicClientSession::StreamRequest::OnRequestCompleteFailure(int rv) { |
131 session_.reset(); | 130 session_.reset(); |
132 ResetAndReturn(&callback_).Run(rv); | 131 ResetAndReturn(&callback_).Run(rv); |
133 } | 132 } |
134 | 133 |
135 QuicClientSession::QuicClientSession( | 134 QuicClientSession::QuicClientSession( |
136 QuicConnection* connection, | 135 QuicConnection* connection, |
137 scoped_ptr<DatagramClientSocket> socket, | 136 scoped_ptr<DatagramClientSocket> socket, |
138 scoped_ptr<QuicDefaultPacketWriter> writer, | |
139 QuicStreamFactory* stream_factory, | 137 QuicStreamFactory* stream_factory, |
140 QuicCryptoClientStreamFactory* crypto_client_stream_factory, | 138 QuicCryptoClientStreamFactory* crypto_client_stream_factory, |
141 scoped_ptr<QuicServerInfo> server_info, | 139 scoped_ptr<QuicServerInfo> server_info, |
142 const QuicServerId& server_id, | 140 const QuicServerId& server_id, |
143 const QuicConfig& config, | 141 const QuicConfig& config, |
144 QuicCryptoClientConfig* crypto_config, | 142 QuicCryptoClientConfig* crypto_config, |
145 base::TaskRunner* task_runner, | 143 base::TaskRunner* task_runner, |
146 NetLog* net_log) | 144 NetLog* net_log) |
147 : QuicClientSessionBase(connection, config), | 145 : QuicClientSessionBase(connection, config), |
148 server_host_port_(server_id.host_port_pair()), | 146 server_host_port_(server_id.host_port_pair()), |
149 require_confirmation_(false), | 147 require_confirmation_(false), |
150 stream_factory_(stream_factory), | 148 stream_factory_(stream_factory), |
151 socket_(socket.Pass()), | 149 socket_(socket.Pass()), |
152 writer_(writer.Pass()), | |
153 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), | 150 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), |
154 server_info_(server_info.Pass()), | 151 server_info_(server_info.Pass()), |
155 read_pending_(false), | 152 read_pending_(false), |
156 num_total_streams_(0), | 153 num_total_streams_(0), |
157 task_runner_(task_runner), | 154 task_runner_(task_runner), |
158 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), | 155 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), |
159 logger_(new QuicConnectionLogger(net_log_)), | 156 logger_(new QuicConnectionLogger(net_log_)), |
160 num_packets_read_(0), | 157 num_packets_read_(0), |
161 going_away_(false), | 158 going_away_(false), |
162 weak_factory_(this) { | 159 weak_factory_(this) { |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 return; | 854 return; |
858 | 855 |
859 // TODO(rch): re-enable this code once beta is cut. | 856 // TODO(rch): re-enable this code once beta is cut. |
860 // if (stream_factory_) | 857 // if (stream_factory_) |
861 // stream_factory_->OnSessionConnectTimeout(this); | 858 // stream_factory_->OnSessionConnectTimeout(this); |
862 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 859 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
863 // DCHECK_EQ(0u, GetNumOpenStreams()); | 860 // DCHECK_EQ(0u, GetNumOpenStreams()); |
864 } | 861 } |
865 | 862 |
866 } // namespace net | 863 } // namespace net |
OLD | NEW |