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/tools/quic/quic_client_session.h" | 5 #include "net/tools/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
9 #include "net/quic/quic_server_id.h" | 9 #include "net/quic/quic_server_id.h" |
10 #include "net/tools/quic/quic_spdy_client_stream.h" | 10 #include "net/tools/quic/quic_spdy_client_stream.h" |
11 | 11 |
12 using std::string; | 12 using std::string; |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 namespace tools { | 15 namespace tools { |
16 | 16 |
17 QuicClientSession::QuicClientSession(const QuicConfig& config, | 17 QuicClientSession::QuicClientSession(const QuicConfig& config, |
18 QuicConnection* connection) | 18 QuicConnection* connection) |
19 : QuicClientSessionBase(connection, config) { | 19 : QuicClientSessionBase(connection, config), respect_goaway_(true) { |
20 } | 20 } |
21 | 21 |
22 QuicClientSession::~QuicClientSession() { | 22 QuicClientSession::~QuicClientSession() { |
23 } | 23 } |
24 | 24 |
25 void QuicClientSession::InitializeSession( | 25 void QuicClientSession::InitializeSession( |
26 const QuicServerId& server_id, | 26 const QuicServerId& server_id, |
27 QuicCryptoClientConfig* crypto_config) { | 27 QuicCryptoClientConfig* crypto_config) { |
28 crypto_stream_.reset( | 28 crypto_stream_.reset( |
29 new QuicCryptoClientStream(server_id, this, nullptr, crypto_config)); | 29 new QuicCryptoClientStream(server_id, this, nullptr, crypto_config)); |
30 QuicClientSessionBase::InitializeSession(); | 30 QuicClientSessionBase::InitializeSession(); |
31 } | 31 } |
32 | 32 |
33 void QuicClientSession::OnProofValid( | 33 void QuicClientSession::OnProofValid( |
34 const QuicCryptoClientConfig::CachedState& /*cached*/) {} | 34 const QuicCryptoClientConfig::CachedState& /*cached*/) {} |
35 | 35 |
36 void QuicClientSession::OnProofVerifyDetailsAvailable( | 36 void QuicClientSession::OnProofVerifyDetailsAvailable( |
37 const ProofVerifyDetails& /*verify_details*/) {} | 37 const ProofVerifyDetails& /*verify_details*/) {} |
38 | 38 |
39 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDataStream() { | 39 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDataStream() { |
40 if (!crypto_stream_->encryption_established()) { | 40 if (!crypto_stream_->encryption_established()) { |
41 DVLOG(1) << "Encryption not active so no outgoing stream created."; | 41 DVLOG(1) << "Encryption not active so no outgoing stream created."; |
42 return nullptr; | 42 return nullptr; |
43 } | 43 } |
44 if (GetNumOpenStreams() >= get_max_open_streams()) { | 44 if (GetNumOpenStreams() >= get_max_open_streams()) { |
45 DVLOG(1) << "Failed to create a new outgoing stream. " | 45 DVLOG(1) << "Failed to create a new outgoing stream. " |
46 << "Already " << GetNumOpenStreams() << " open."; | 46 << "Already " << GetNumOpenStreams() << " open."; |
47 return nullptr; | 47 return nullptr; |
48 } | 48 } |
49 if (goaway_received()) { | 49 if (goaway_received() && respect_goaway_) { |
50 DVLOG(1) << "Failed to create a new outgoing stream. " | 50 DVLOG(1) << "Failed to create a new outgoing stream. " |
51 << "Already received goaway."; | 51 << "Already received goaway."; |
52 return nullptr; | 52 return nullptr; |
53 } | 53 } |
54 QuicSpdyClientStream* stream | 54 QuicSpdyClientStream* stream |
55 = new QuicSpdyClientStream(GetNextStreamId(), this); | 55 = new QuicSpdyClientStream(GetNextStreamId(), this); |
56 ActivateStream(stream); | 56 ActivateStream(stream); |
57 return stream; | 57 return stream; |
58 } | 58 } |
59 | 59 |
(...skipping 11 matching lines...) Expand all Loading... |
71 } | 71 } |
72 | 72 |
73 QuicDataStream* QuicClientSession::CreateIncomingDataStream( | 73 QuicDataStream* QuicClientSession::CreateIncomingDataStream( |
74 QuicStreamId id) { | 74 QuicStreamId id) { |
75 DLOG(ERROR) << "Server push not supported"; | 75 DLOG(ERROR) << "Server push not supported"; |
76 return nullptr; | 76 return nullptr; |
77 } | 77 } |
78 | 78 |
79 } // namespace tools | 79 } // namespace tools |
80 } // namespace net | 80 } // namespace net |
OLD | NEW |