| 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 // A client specific QuicSession subclass. | 5 // A client specific QuicSession subclass. |
| 6 | 6 |
| 7 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
| 8 #define NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 8 #define NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const QuicServerId& server_id, | 30 const QuicServerId& server_id, |
| 31 QuicCryptoClientConfig* crypto_config, | 31 QuicCryptoClientConfig* crypto_config, |
| 32 QuicClientPushPromiseIndex* push_promise_index); | 32 QuicClientPushPromiseIndex* push_promise_index); |
| 33 ~QuicClientSession() override; | 33 ~QuicClientSession() override; |
| 34 // Set up the QuicClientSession. Must be called prior to use. | 34 // Set up the QuicClientSession. Must be called prior to use. |
| 35 void Initialize() override; | 35 void Initialize() override; |
| 36 | 36 |
| 37 // QuicSession methods: | 37 // QuicSession methods: |
| 38 QuicSpdyClientStream* CreateOutgoingDynamicStream( | 38 QuicSpdyClientStream* CreateOutgoingDynamicStream( |
| 39 SpdyPriority priority) override; | 39 SpdyPriority priority) override; |
| 40 QuicSpdyClientStream* MaybeCreateOutgoingDynamicStream( |
| 41 SpdyPriority priority) override; |
| 40 QuicCryptoClientStreamBase* GetMutableCryptoStream() override; | 42 QuicCryptoClientStreamBase* GetMutableCryptoStream() override; |
| 41 const QuicCryptoClientStreamBase* GetCryptoStream() const override; | 43 const QuicCryptoClientStreamBase* GetCryptoStream() const override; |
| 42 | 44 |
| 43 bool IsAuthorized(const std::string& authority) override; | 45 bool IsAuthorized(const std::string& authority) override; |
| 44 | 46 |
| 45 // QuicClientSessionBase methods: | 47 // QuicClientSessionBase methods: |
| 46 void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override; | 48 void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override; |
| 47 void OnProofVerifyDetailsAvailable( | 49 void OnProofVerifyDetailsAvailable( |
| 48 const ProofVerifyDetails& verify_details) override; | 50 const ProofVerifyDetails& verify_details) override; |
| 49 | 51 |
| 50 // Performs a crypto handshake with the server. | 52 // Performs a crypto handshake with the server. |
| 51 virtual void CryptoConnect(); | 53 virtual void CryptoConnect(); |
| 52 | 54 |
| 53 // Returns the number of client hello messages that have been sent on the | 55 // Returns the number of client hello messages that have been sent on the |
| 54 // crypto stream. If the handshake has completed then this is one greater | 56 // crypto stream. If the handshake has completed then this is one greater |
| 55 // than the number of round-trips needed for the handshake. | 57 // than the number of round-trips needed for the handshake. |
| 56 int GetNumSentClientHellos() const; | 58 int GetNumSentClientHellos() const; |
| 57 | 59 |
| 58 int GetNumReceivedServerConfigUpdates() const; | 60 int GetNumReceivedServerConfigUpdates() const; |
| 59 | 61 |
| 60 void set_respect_goaway(bool respect_goaway) { | |
| 61 respect_goaway_ = respect_goaway; | |
| 62 } | |
| 63 | |
| 64 protected: | 62 protected: |
| 65 // QuicSession methods: | 63 // QuicSession methods: |
| 66 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 64 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
| 67 // If an outgoing stream can be created, return true. | 65 // If an outgoing stream can be created, return true. |
| 68 bool ShouldCreateOutgoingDynamicStream() override; | 66 bool ShouldCreateOutgoingDynamicStream() override; |
| 69 | 67 |
| 70 // If an incoming stream can be created, return true. | 68 // If an incoming stream can be created, return true. |
| 71 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; | 69 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; |
| 70 QuicSpdyStream* MaybeCreateIncomingDynamicStream(QuicStreamId id) override; |
| 71 std::unique_ptr<QuicStream> CreateStream(QuicStreamId id) override; |
| 72 | 72 |
| 73 // Create the crypto stream. Called by Initialize(). | 73 // Create the crypto stream. Called by Initialize(). |
| 74 virtual std::unique_ptr<QuicCryptoClientStreamBase> CreateQuicCryptoStream(); | 74 virtual std::unique_ptr<QuicCryptoClientStreamBase> CreateQuicCryptoStream(); |
| 75 | 75 |
| 76 // TODO(ckrasic) remove when |
| 77 // quic_reloadable_flag_quic_refactor_stream_creation is deprecated. |
| 76 // Unlike CreateOutgoingDynamicStream, which applies a bunch of sanity checks, | 78 // Unlike CreateOutgoingDynamicStream, which applies a bunch of sanity checks, |
| 77 // this simply returns a new QuicSpdyClientStream. This may be used by | 79 // this simply returns a new QuicSpdyClientStream. This may be used by |
| 78 // subclasses which want to use a subclass of QuicSpdyClientStream for streams | 80 // subclasses which want to use a subclass of QuicSpdyClientStream for streams |
| 79 // but wish to use the sanity checks in CreateOutgoingDynamicStream. | 81 // but wish to use the sanity checks in CreateOutgoingDynamicStream. |
| 80 virtual std::unique_ptr<QuicSpdyClientStream> CreateClientStream(); | 82 virtual std::unique_ptr<QuicSpdyClientStream> CreateClientStream(); |
| 81 | 83 |
| 82 const QuicServerId& server_id() { return server_id_; } | 84 const QuicServerId& server_id() { return server_id_; } |
| 83 QuicCryptoClientConfig* crypto_config() { return crypto_config_; } | 85 QuicCryptoClientConfig* crypto_config() { return crypto_config_; } |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 std::unique_ptr<QuicCryptoClientStreamBase> crypto_stream_; | 88 std::unique_ptr<QuicCryptoClientStreamBase> crypto_stream_; |
| 87 QuicServerId server_id_; | 89 QuicServerId server_id_; |
| 88 QuicCryptoClientConfig* crypto_config_; | 90 QuicCryptoClientConfig* crypto_config_; |
| 89 | 91 |
| 90 // If this is set to false, the client will ignore server GOAWAYs and allow | |
| 91 // the creation of streams regardless of the high chance they will fail. | |
| 92 bool respect_goaway_; | |
| 93 | |
| 94 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 92 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
| 95 }; | 93 }; |
| 96 | 94 |
| 97 } // namespace net | 95 } // namespace net |
| 98 | 96 |
| 99 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 97 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
| OLD | NEW |