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

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

Issue 407193002: QUIC - undo the chromium specific changes from the following CL which (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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_client_session_test.cc » ('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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 session_.reset(); 125 session_.reset();
126 *stream_ = stream; 126 *stream_ = stream;
127 ResetAndReturn(&callback_).Run(OK); 127 ResetAndReturn(&callback_).Run(OK);
128 } 128 }
129 129
130 void QuicClientSession::StreamRequest::OnRequestCompleteFailure(int rv) { 130 void QuicClientSession::StreamRequest::OnRequestCompleteFailure(int rv) {
131 session_.reset(); 131 session_.reset();
132 ResetAndReturn(&callback_).Run(rv); 132 ResetAndReturn(&callback_).Run(rv);
133 } 133 }
134 134
135 QuicClientSession::QuicClientSession(QuicConnection* connection, 135 QuicClientSession::QuicClientSession(
136 scoped_ptr<DatagramClientSocket> socket, 136 QuicConnection* connection,
137 scoped_ptr<QuicDefaultPacketWriter> writer, 137 scoped_ptr<DatagramClientSocket> socket,
138 QuicStreamFactory* stream_factory, 138 scoped_ptr<QuicDefaultPacketWriter> writer,
139 scoped_ptr<QuicServerInfo> server_info, 139 QuicStreamFactory* stream_factory,
140 const QuicConfig& config, 140 QuicCryptoClientStreamFactory* crypto_client_stream_factory,
141 base::TaskRunner* task_runner, 141 scoped_ptr<QuicServerInfo> server_info,
142 NetLog* net_log) 142 const QuicServerId& server_id,
143 const QuicConfig& config,
144 QuicCryptoClientConfig* crypto_config,
145 base::TaskRunner* task_runner,
146 NetLog* net_log)
143 : QuicClientSessionBase(connection, config), 147 : QuicClientSessionBase(connection, config),
148 server_host_port_(server_id.host_port_pair()),
144 require_confirmation_(false), 149 require_confirmation_(false),
145 stream_factory_(stream_factory), 150 stream_factory_(stream_factory),
146 socket_(socket.Pass()), 151 socket_(socket.Pass()),
147 writer_(writer.Pass()), 152 writer_(writer.Pass()),
148 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 153 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
149 server_info_(server_info.Pass()), 154 server_info_(server_info.Pass()),
150 read_pending_(false), 155 read_pending_(false),
151 num_total_streams_(0), 156 num_total_streams_(0),
152 task_runner_(task_runner), 157 task_runner_(task_runner),
153 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 158 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
154 logger_(net_log_), 159 logger_(net_log_),
155 num_packets_read_(0), 160 num_packets_read_(0),
156 going_away_(false), 161 going_away_(false),
157 weak_factory_(this) { 162 weak_factory_(this) {
158 connection->set_debug_visitor(&logger_);
159 }
160
161 void QuicClientSession::InitializeSession(
162 const QuicServerId& server_id,
163 QuicCryptoClientConfig* crypto_config,
164 QuicCryptoClientStreamFactory* crypto_client_stream_factory) {
165 QuicClientSessionBase::InitializeSession();
166 server_host_port_.reset(new HostPortPair(server_id.host_port_pair()));
167 crypto_stream_.reset( 163 crypto_stream_.reset(
168 crypto_client_stream_factory ? 164 crypto_client_stream_factory ?
169 crypto_client_stream_factory->CreateQuicCryptoClientStream( 165 crypto_client_stream_factory->CreateQuicCryptoClientStream(
170 server_id, this, crypto_config) : 166 server_id, this, crypto_config) :
171 new QuicCryptoClientStream(server_id, this, 167 new QuicCryptoClientStream(server_id, this,
172 new ProofVerifyContextChromium(net_log_), 168 new ProofVerifyContextChromium(net_log_),
173 crypto_config)); 169 crypto_config));
174 170
171 connection->set_debug_visitor(&logger_);
175 // TODO(rch): pass in full host port proxy pair 172 // TODO(rch): pass in full host port proxy pair
176 net_log_.BeginEvent( 173 net_log_.BeginEvent(
177 NetLog::TYPE_QUIC_SESSION, 174 NetLog::TYPE_QUIC_SESSION,
178 NetLog::StringCallback("host", &server_id.host())); 175 NetLog::StringCallback("host", &server_id.host()));
179 } 176 }
180 177
181 QuicClientSession::~QuicClientSession() { 178 QuicClientSession::~QuicClientSession() {
182 if (!streams()->empty()) 179 if (!streams()->empty())
183 RecordUnexpectedOpenStreams(DESTRUCTOR); 180 RecordUnexpectedOpenStreams(DESTRUCTOR);
184 if (!observers_.empty()) 181 if (!observers_.empty())
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // and for connections on which client certs were sent. It is also prohibited 493 // and for connections on which client certs were sent. It is also prohibited
497 // when channel ID was sent if the hosts are from different eTLDs+1. 494 // when channel ID was sent if the hosts are from different eTLDs+1.
498 if (!ssl_info.cert->VerifyNameMatch(hostname, &unused)) 495 if (!ssl_info.cert->VerifyNameMatch(hostname, &unused))
499 return false; 496 return false;
500 497
501 if (ssl_info.client_cert_sent) 498 if (ssl_info.client_cert_sent)
502 return false; 499 return false;
503 500
504 if (ssl_info.channel_id_sent && 501 if (ssl_info.channel_id_sent &&
505 ServerBoundCertService::GetDomainForHost(hostname) != 502 ServerBoundCertService::GetDomainForHost(hostname) !=
506 ServerBoundCertService::GetDomainForHost(server_host_port_->host())) { 503 ServerBoundCertService::GetDomainForHost(server_host_port_.host())) {
507 return false; 504 return false;
508 } 505 }
509 506
510 return true; 507 return true;
511 } 508 }
512 509
513 QuicDataStream* QuicClientSession::CreateIncomingDataStream( 510 QuicDataStream* QuicClientSession::CreateIncomingDataStream(
514 QuicStreamId id) { 511 QuicStreamId id) {
515 DLOG(ERROR) << "Server push not supported"; 512 DLOG(ERROR) << "Server push not supported";
516 return NULL; 513 return NULL;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698