Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / tools / quic / quic_client_session.cc
blob99371b261fc056fdf68a7fa8fb453486acd6d042
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
3 // found in the LICENSE file.
5 #include "net/tools/quic/quic_client_session.h"
7 #include "base/logging.h"
8 #include "net/quic/crypto/crypto_protocol.h"
9 #include "net/quic/crypto/proof_verifier_chromium.h"
10 #include "net/quic/quic_server_id.h"
11 #include "net/tools/quic/quic_spdy_client_stream.h"
13 using std::string;
15 namespace net {
16 namespace tools {
18 QuicClientSession::QuicClientSession(const QuicConfig& config,
19 QuicConnection* connection,
20 const QuicServerId& server_id,
21 QuicCryptoClientConfig* crypto_config)
22 : QuicClientSessionBase(connection, config),
23 crypto_stream_(new QuicCryptoClientStream(
24 server_id,
25 this,
26 new ProofVerifyContextChromium(0, BoundNetLog()),
27 crypto_config)),
28 respect_goaway_(true) {
31 QuicClientSession::~QuicClientSession() {
34 void QuicClientSession::OnProofValid(
35 const QuicCryptoClientConfig::CachedState& /*cached*/) {}
37 void QuicClientSession::OnProofVerifyDetailsAvailable(
38 const ProofVerifyDetails& /*verify_details*/) {}
40 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream() {
41 if (!crypto_stream_->encryption_established()) {
42 DVLOG(1) << "Encryption not active so no outgoing stream created.";
43 return nullptr;
45 if (GetNumOpenStreams() >= get_max_open_streams()) {
46 DVLOG(1) << "Failed to create a new outgoing stream. "
47 << "Already " << GetNumOpenStreams() << " open.";
48 return nullptr;
50 if (goaway_received() && respect_goaway_) {
51 DVLOG(1) << "Failed to create a new outgoing stream. "
52 << "Already received goaway.";
53 return nullptr;
55 QuicSpdyClientStream* stream = CreateClientStream();
56 ActivateStream(stream);
57 return stream;
60 QuicSpdyClientStream* QuicClientSession::CreateClientStream() {
61 return new QuicSpdyClientStream(GetNextStreamId(), this);
64 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() {
65 return crypto_stream_.get();
68 void QuicClientSession::CryptoConnect() {
69 DCHECK(flow_controller());
70 crypto_stream_->CryptoConnect();
73 int QuicClientSession::GetNumSentClientHellos() const {
74 return crypto_stream_->num_sent_client_hellos();
77 QuicDataStream* QuicClientSession::CreateIncomingDynamicStream(
78 QuicStreamId id) {
79 DLOG(ERROR) << "Server push not supported";
80 return nullptr;
83 } // namespace tools
84 } // namespace net