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