Fix "#if defined(DEBUG)" statements
[chromium-blink-merge.git] / net / tools / quic / quic_client_session.cc
blobdb885dc079437e1babb75268657173de9a505476
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/quic_server_id.h"
10 #include "net/tools/quic/quic_spdy_client_stream.h"
12 using std::string;
14 namespace net {
15 namespace tools {
17 QuicClientSession::QuicClientSession(const QuicConfig& config,
18 QuicConnection* connection)
19 : QuicClientSessionBase(connection, config) {
22 QuicClientSession::~QuicClientSession() {
25 void QuicClientSession::InitializeSession(
26 const QuicServerId& server_id,
27 QuicCryptoClientConfig* crypto_config) {
28 QuicClientSessionBase::InitializeSession();
29 crypto_stream_.reset(
30 new QuicCryptoClientStream(server_id, this, nullptr, crypto_config));
33 void QuicClientSession::OnProofValid(
34 const QuicCryptoClientConfig::CachedState& /*cached*/) {
37 void QuicClientSession::OnProofVerifyDetailsAvailable(
38 const ProofVerifyDetails& /*verify_details*/) {
41 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDataStream() {
42 if (!crypto_stream_->encryption_established()) {
43 DVLOG(1) << "Encryption not active so no outgoing stream created.";
44 return nullptr;
46 if (GetNumOpenStreams() >= get_max_open_streams()) {
47 DVLOG(1) << "Failed to create a new outgoing stream. "
48 << "Already " << GetNumOpenStreams() << " open.";
49 return nullptr;
51 if (goaway_received()) {
52 DVLOG(1) << "Failed to create a new outgoing stream. "
53 << "Already received goaway.";
54 return nullptr;
56 QuicSpdyClientStream* stream
57 = new QuicSpdyClientStream(GetNextStreamId(), this);
58 ActivateStream(stream);
59 return stream;
62 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() {
63 return crypto_stream_.get();
66 bool QuicClientSession::CryptoConnect() {
67 DCHECK(flow_controller());
68 return crypto_stream_->CryptoConnect();
71 int QuicClientSession::GetNumSentClientHellos() const {
72 return crypto_stream_->num_sent_client_hellos();
75 QuicDataStream* QuicClientSession::CreateIncomingDataStream(
76 QuicStreamId id) {
77 DLOG(ERROR) << "Server push not supported";
78 return nullptr;
81 } // namespace tools
82 } // namespace net