Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Side by Side Diff: net/tools/quic/quic_server_session.h

Issue 1413613016: Factoring a QuicCryptoServerStreamBase API out of QuicCryptoServerStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106845547
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_dispatcher_test.cc ('k') | net/tools/quic/quic_server_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 server specific QuicSession subclass. 5 // A server specific QuicSession subclass.
6 6
7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ 7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
9 9
10 #include <set> 10 #include <set>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void OnWriteBlocked() override; 63 void OnWriteBlocked() override;
64 64
65 // Sends a server config update to the client, containing new bandwidth 65 // Sends a server config update to the client, containing new bandwidth
66 // estimate. 66 // estimate.
67 void OnCongestionWindowChange(QuicTime now) override; 67 void OnCongestionWindowChange(QuicTime now) override;
68 68
69 ~QuicServerSession() override; 69 ~QuicServerSession() override;
70 70
71 void Initialize() override; 71 void Initialize() override;
72 72
73 const QuicCryptoServerStream* crypto_stream() const { 73 const QuicCryptoServerStreamBase* crypto_stream() const {
74 return crypto_stream_.get(); 74 return crypto_stream_.get();
75 } 75 }
76 76
77 // Override base class to process FEC config received from client. 77 // Override base class to process FEC config received from client.
78 void OnConfigNegotiated() override; 78 void OnConfigNegotiated() override;
79 79
80 bool UsingStatelessRejectsIfPeerSupported() { 80 bool UsingStatelessRejectsIfPeerSupported() {
81 if (GetCryptoStream() == nullptr) { 81 if (GetCryptoStream() == nullptr) {
82 return false; 82 return false;
83 } 83 }
84 return GetCryptoStream()->use_stateless_rejects_if_peer_supported(); 84 return GetCryptoStream()->UseStatelessRejectsIfPeerSupported();
85 } 85 }
86 86
87 bool PeerSupportsStatelessRejects() { 87 bool PeerSupportsStatelessRejects() {
88 if (GetCryptoStream() == nullptr) { 88 if (GetCryptoStream() == nullptr) {
89 return false; 89 return false;
90 } 90 }
91 return GetCryptoStream()->peer_supports_stateless_rejects(); 91 return GetCryptoStream()->PeerSupportsStatelessRejects();
92 } 92 }
93 93
94 void set_serving_region(const std::string& serving_region) { 94 void set_serving_region(const std::string& serving_region) {
95 serving_region_ = serving_region; 95 serving_region_ = serving_region;
96 } 96 }
97 97
98 protected: 98 protected:
99 // QuicSession methods: 99 // QuicSession methods:
100 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; 100 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override;
101 QuicSpdyStream* CreateOutgoingDynamicStream() override; 101 QuicSpdyStream* CreateOutgoingDynamicStream() override;
102 QuicCryptoServerStream* GetCryptoStream() override; 102 QuicCryptoServerStreamBase* GetCryptoStream() override;
103 103
104 // If we should create an incoming stream, returns true. Otherwise 104 // If we should create an incoming stream, returns true. Otherwise
105 // does error handling, including communicating the error to the client and 105 // does error handling, including communicating the error to the client and
106 // possibly closing the connection, and returns false. 106 // possibly closing the connection, and returns false.
107 virtual bool ShouldCreateIncomingDynamicStream(QuicStreamId id); 107 virtual bool ShouldCreateIncomingDynamicStream(QuicStreamId id);
108 108
109 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( 109 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream(
110 const QuicCryptoServerConfig* crypto_config); 110 const QuicCryptoServerConfig* crypto_config);
111 111
112 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; }
113
112 private: 114 private:
113 friend class test::QuicServerSessionPeer; 115 friend class test::QuicServerSessionPeer;
114 116
115 const QuicCryptoServerConfig* crypto_config_; 117 const QuicCryptoServerConfig* crypto_config_;
116 scoped_ptr<QuicCryptoServerStream> crypto_stream_; 118 scoped_ptr<QuicCryptoServerStreamBase> crypto_stream_;
117 QuicServerSessionVisitor* visitor_; 119 QuicServerSessionVisitor* visitor_;
118 120
119 // Whether bandwidth resumption is enabled for this connection. 121 // Whether bandwidth resumption is enabled for this connection.
120 bool bandwidth_resumption_enabled_; 122 bool bandwidth_resumption_enabled_;
121 123
122 // The most recent bandwidth estimate sent to the client. 124 // The most recent bandwidth estimate sent to the client.
123 QuicBandwidth bandwidth_estimate_sent_to_client_; 125 QuicBandwidth bandwidth_estimate_sent_to_client_;
124 126
125 // Text describing server location. Sent to the client as part of the bandwith 127 // Text describing server location. Sent to the client as part of the bandwith
126 // estimate in the source-address token. Optional, can be left empty. 128 // estimate in the source-address token. Optional, can be left empty.
127 std::string serving_region_; 129 std::string serving_region_;
128 130
129 // Time at which we send the last SCUP to the client. 131 // Time at which we send the last SCUP to the client.
130 QuicTime last_scup_time_; 132 QuicTime last_scup_time_;
131 133
132 // Number of packets sent to the peer, at the time we last sent a SCUP. 134 // Number of packets sent to the peer, at the time we last sent a SCUP.
133 int64 last_scup_packet_number_; 135 int64 last_scup_packet_number_;
134 136
135 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); 137 DISALLOW_COPY_AND_ASSIGN(QuicServerSession);
136 }; 138 };
137 139
138 } // namespace tools 140 } // namespace tools
139 } // namespace net 141 } // namespace net
140 142
141 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ 143 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher_test.cc ('k') | net/tools/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698