| 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" | |
| 8 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 9 #include "net/log/net_log_with_source.h" | 8 #include "net/log/net_log_with_source.h" |
| 10 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | 9 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" |
| 11 #include "net/quic/core/crypto/crypto_protocol.h" | 10 #include "net/quic/core/crypto/crypto_protocol.h" |
| 12 #include "net/quic/core/quic_server_id.h" | 11 #include "net/quic/core/quic_server_id.h" |
| 13 #include "net/quic/platform/api/quic_bug_tracker.h" | 12 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 13 #include "net/quic/platform/api/quic_logging.h" |
| 14 #include "net/tools/quic/quic_spdy_client_stream.h" | 14 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 15 | 15 |
| 16 using std::string; | 16 using std::string; |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 QuicClientSession::QuicClientSession( | 20 QuicClientSession::QuicClientSession( |
| 21 const QuicConfig& config, | 21 const QuicConfig& config, |
| 22 QuicConnection* connection, | 22 QuicConnection* connection, |
| 23 const QuicServerId& server_id, | 23 const QuicServerId& server_id, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 void QuicClientSession::OnProofValid( | 38 void QuicClientSession::OnProofValid( |
| 39 const QuicCryptoClientConfig::CachedState& /*cached*/) {} | 39 const QuicCryptoClientConfig::CachedState& /*cached*/) {} |
| 40 | 40 |
| 41 void QuicClientSession::OnProofVerifyDetailsAvailable( | 41 void QuicClientSession::OnProofVerifyDetailsAvailable( |
| 42 const ProofVerifyDetails& /*verify_details*/) {} | 42 const ProofVerifyDetails& /*verify_details*/) {} |
| 43 | 43 |
| 44 bool QuicClientSession::ShouldCreateOutgoingDynamicStream() { | 44 bool QuicClientSession::ShouldCreateOutgoingDynamicStream() { |
| 45 if (!crypto_stream_->encryption_established()) { | 45 if (!crypto_stream_->encryption_established()) { |
| 46 DVLOG(1) << "Encryption not active so no outgoing stream created."; | 46 QUIC_DLOG(INFO) << "Encryption not active so no outgoing stream created."; |
| 47 return false; | 47 return false; |
| 48 } | 48 } |
| 49 if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) { | 49 if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) { |
| 50 DVLOG(1) << "Failed to create a new outgoing stream. " | 50 QUIC_DLOG(INFO) << "Failed to create a new outgoing stream. " |
| 51 << "Already " << GetNumOpenOutgoingStreams() << " open."; | 51 << "Already " << GetNumOpenOutgoingStreams() << " open."; |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 if (goaway_received() && respect_goaway_) { | 54 if (goaway_received() && respect_goaway_) { |
| 55 DVLOG(1) << "Failed to create a new outgoing stream. " | 55 QUIC_DLOG(INFO) << "Failed to create a new outgoing stream. " |
| 56 << "Already received goaway."; | 56 << "Already received goaway."; |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 return true; | 59 return true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream( | 62 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream( |
| 63 SpdyPriority priority) { | 63 SpdyPriority priority) { |
| 64 if (!ShouldCreateOutgoingDynamicStream()) { | 64 if (!ShouldCreateOutgoingDynamicStream()) { |
| 65 return nullptr; | 65 return nullptr; |
| 66 } | 66 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 92 int QuicClientSession::GetNumReceivedServerConfigUpdates() const { | 92 int QuicClientSession::GetNumReceivedServerConfigUpdates() const { |
| 93 return crypto_stream_->num_scup_messages_received(); | 93 return crypto_stream_->num_scup_messages_received(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool QuicClientSession::ShouldCreateIncomingDynamicStream(QuicStreamId id) { | 96 bool QuicClientSession::ShouldCreateIncomingDynamicStream(QuicStreamId id) { |
| 97 if (!connection()->connected()) { | 97 if (!connection()->connected()) { |
| 98 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; | 98 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; |
| 99 return false; | 99 return false; |
| 100 } | 100 } |
| 101 if (goaway_received() && respect_goaway_) { | 101 if (goaway_received() && respect_goaway_) { |
| 102 DVLOG(1) << "Failed to create a new outgoing stream. " | 102 QUIC_DLOG(INFO) << "Failed to create a new outgoing stream. " |
| 103 << "Already received goaway."; | 103 << "Already received goaway."; |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 if (id % 2 != 0) { | 106 if (id % 2 != 0) { |
| 107 LOG(WARNING) << "Received invalid push stream id " << id; | 107 QUIC_LOG(WARNING) << "Received invalid push stream id " << id; |
| 108 connection()->CloseConnection( | 108 connection()->CloseConnection( |
| 109 QUIC_INVALID_STREAM_ID, "Server created odd numbered stream", | 109 QUIC_INVALID_STREAM_ID, "Server created odd numbered stream", |
| 110 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 110 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| 113 return true; | 113 return true; |
| 114 } | 114 } |
| 115 | 115 |
| 116 QuicSpdyStream* QuicClientSession::CreateIncomingDynamicStream( | 116 QuicSpdyStream* QuicClientSession::CreateIncomingDynamicStream( |
| 117 QuicStreamId id) { | 117 QuicStreamId id) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 129 return base::MakeUnique<QuicCryptoClientStream>( | 129 return base::MakeUnique<QuicCryptoClientStream>( |
| 130 server_id_, this, new ProofVerifyContextChromium(0, NetLogWithSource()), | 130 server_id_, this, new ProofVerifyContextChromium(0, NetLogWithSource()), |
| 131 crypto_config_, this); | 131 crypto_config_, this); |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool QuicClientSession::IsAuthorized(const string& authority) { | 134 bool QuicClientSession::IsAuthorized(const string& authority) { |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace net | 138 } // namespace net |
| OLD | NEW |