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; | |
42 QuicCryptoClientStreamBase* GetMutableCryptoStream() override; | 40 QuicCryptoClientStreamBase* GetMutableCryptoStream() override; |
43 const QuicCryptoClientStreamBase* GetCryptoStream() const override; | 41 const QuicCryptoClientStreamBase* GetCryptoStream() const override; |
44 | 42 |
45 bool IsAuthorized(const std::string& authority) override; | 43 bool IsAuthorized(const std::string& authority) override; |
46 | 44 |
47 // QuicClientSessionBase methods: | 45 // QuicClientSessionBase methods: |
48 void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override; | 46 void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override; |
49 void OnProofVerifyDetailsAvailable( | 47 void OnProofVerifyDetailsAvailable( |
50 const ProofVerifyDetails& verify_details) override; | 48 const ProofVerifyDetails& verify_details) override; |
51 | 49 |
52 // Performs a crypto handshake with the server. | 50 // Performs a crypto handshake with the server. |
53 virtual void CryptoConnect(); | 51 virtual void CryptoConnect(); |
54 | 52 |
55 // Returns the number of client hello messages that have been sent on the | 53 // Returns the number of client hello messages that have been sent on the |
56 // crypto stream. If the handshake has completed then this is one greater | 54 // crypto stream. If the handshake has completed then this is one greater |
57 // than the number of round-trips needed for the handshake. | 55 // than the number of round-trips needed for the handshake. |
58 int GetNumSentClientHellos() const; | 56 int GetNumSentClientHellos() const; |
59 | 57 |
60 int GetNumReceivedServerConfigUpdates() const; | 58 int GetNumReceivedServerConfigUpdates() const; |
61 | 59 |
| 60 void set_respect_goaway(bool respect_goaway) { |
| 61 respect_goaway_ = respect_goaway; |
| 62 } |
| 63 |
62 protected: | 64 protected: |
63 // QuicSession methods: | 65 // QuicSession methods: |
64 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 66 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
65 // If an outgoing stream can be created, return true. | 67 // If an outgoing stream can be created, return true. |
66 bool ShouldCreateOutgoingDynamicStream() override; | 68 bool ShouldCreateOutgoingDynamicStream() override; |
67 | 69 |
68 // If an incoming stream can be created, return true. | 70 // If an incoming stream can be created, return true. |
69 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; | 71 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. | |
78 // Unlike CreateOutgoingDynamicStream, which applies a bunch of sanity checks, | 76 // Unlike CreateOutgoingDynamicStream, which applies a bunch of sanity checks, |
79 // this simply returns a new QuicSpdyClientStream. This may be used by | 77 // this simply returns a new QuicSpdyClientStream. This may be used by |
80 // subclasses which want to use a subclass of QuicSpdyClientStream for streams | 78 // subclasses which want to use a subclass of QuicSpdyClientStream for streams |
81 // but wish to use the sanity checks in CreateOutgoingDynamicStream. | 79 // but wish to use the sanity checks in CreateOutgoingDynamicStream. |
82 virtual std::unique_ptr<QuicSpdyClientStream> CreateClientStream(); | 80 virtual std::unique_ptr<QuicSpdyClientStream> CreateClientStream(); |
83 | 81 |
84 const QuicServerId& server_id() { return server_id_; } | 82 const QuicServerId& server_id() { return server_id_; } |
85 QuicCryptoClientConfig* crypto_config() { return crypto_config_; } | 83 QuicCryptoClientConfig* crypto_config() { return crypto_config_; } |
86 | 84 |
87 private: | 85 private: |
88 std::unique_ptr<QuicCryptoClientStreamBase> crypto_stream_; | 86 std::unique_ptr<QuicCryptoClientStreamBase> crypto_stream_; |
89 QuicServerId server_id_; | 87 QuicServerId server_id_; |
90 QuicCryptoClientConfig* crypto_config_; | 88 QuicCryptoClientConfig* crypto_config_; |
91 | 89 |
| 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 |
92 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 94 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
93 }; | 95 }; |
94 | 96 |
95 } // namespace net | 97 } // namespace net |
96 | 98 |
97 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 99 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
OLD | NEW |