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

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

Issue 1190823003: Remove dependency on headers stream from QuicSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0616
Patch Set: deleted an include Created 5 years, 6 months 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_server_session.h ('k') | net/tools/quic/quic_server_session_test.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 #include "net/tools/quic/quic_server_session.h" 5 #include "net/tools/quic/quic_server_session.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/proto/cached_network_parameters.pb.h" 8 #include "net/quic/proto/cached_network_parameters.pb.h"
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_flags.h" 10 #include "net/quic/quic_flags.h"
11 #include "net/quic/quic_spdy_session.h"
11 #include "net/quic/reliable_quic_stream.h" 12 #include "net/quic/reliable_quic_stream.h"
12 #include "net/tools/quic/quic_spdy_server_stream.h" 13 #include "net/tools/quic/quic_spdy_server_stream.h"
13 14
14 namespace net { 15 namespace net {
15 namespace tools { 16 namespace tools {
16 17
17 QuicServerSession::QuicServerSession( 18 QuicServerSession::QuicServerSession(
18 const QuicConfig& config, 19 const QuicConfig& config,
19 QuicConnection* connection, 20 QuicConnection* connection,
20 QuicServerSessionVisitor* visitor, 21 QuicServerSessionVisitor* visitor,
21 const QuicCryptoServerConfig* crypto_config) 22 const QuicCryptoServerConfig* crypto_config)
22 : QuicSession(connection, config), 23 : QuicSpdySession(connection, config),
23 crypto_config_(crypto_config), 24 crypto_config_(crypto_config),
24 visitor_(visitor), 25 visitor_(visitor),
25 bandwidth_resumption_enabled_(false), 26 bandwidth_resumption_enabled_(false),
26 bandwidth_estimate_sent_to_client_(QuicBandwidth::Zero()), 27 bandwidth_estimate_sent_to_client_(QuicBandwidth::Zero()),
27 last_scup_time_(QuicTime::Zero()), 28 last_scup_time_(QuicTime::Zero()),
28 last_scup_sequence_number_(0) { 29 last_scup_sequence_number_(0) {
29 } 30 }
30 31
31 QuicServerSession::~QuicServerSession() {} 32 QuicServerSession::~QuicServerSession() {}
32 33
33 void QuicServerSession::Initialize() { 34 void QuicServerSession::Initialize() {
34 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config_)); 35 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config_));
35 QuicSession::Initialize(); 36 QuicSpdySession::Initialize();
36 } 37 }
37 38
38 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( 39 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream(
39 const QuicCryptoServerConfig* crypto_config) { 40 const QuicCryptoServerConfig* crypto_config) {
40 return new QuicCryptoServerStream(crypto_config, this); 41 return new QuicCryptoServerStream(crypto_config, this);
41 } 42 }
42 43
43 void QuicServerSession::OnConfigNegotiated() { 44 void QuicServerSession::OnConfigNegotiated() {
44 QuicSession::OnConfigNegotiated(); 45 QuicSession::OnConfigNegotiated();
45 46
(...skipping 15 matching lines...) Expand all
61 if (cached_network_params != nullptr && bandwidth_resumption_enabled_ && 62 if (cached_network_params != nullptr && bandwidth_resumption_enabled_ &&
62 cached_network_params->serving_region() == serving_region_) { 63 cached_network_params->serving_region() == serving_region_) {
63 connection()->ResumeConnectionState(*cached_network_params, 64 connection()->ResumeConnectionState(*cached_network_params,
64 max_bandwidth_resumption); 65 max_bandwidth_resumption);
65 } 66 }
66 67
67 if (FLAGS_enable_quic_fec && 68 if (FLAGS_enable_quic_fec &&
68 ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) { 69 ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) {
69 // kFHDR config maps to FEC protection always for headers stream. 70 // kFHDR config maps to FEC protection always for headers stream.
70 // TODO(jri): Add crypto stream in addition to headers for kHDR. 71 // TODO(jri): Add crypto stream in addition to headers for kHDR.
71 headers_stream_->set_fec_policy(FEC_PROTECT_ALWAYS); 72 headers_stream()->set_fec_policy(FEC_PROTECT_ALWAYS);
72 } 73 }
73 } 74 }
74 75
75 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, 76 void QuicServerSession::OnConnectionClosed(QuicErrorCode error,
76 bool from_peer) { 77 bool from_peer) {
77 QuicSession::OnConnectionClosed(error, from_peer); 78 QuicSession::OnConnectionClosed(error, from_peer);
78 // In the unlikely event we get a connection close while doing an asynchronous 79 // In the unlikely event we get a connection close while doing an asynchronous
79 // crypto event, make sure we cancel the callback. 80 // crypto event, make sure we cancel the callback.
80 if (crypto_stream_.get() != nullptr) { 81 if (crypto_stream_.get() != nullptr) {
81 crypto_stream_->CancelOutstandingCallbacks(); 82 crypto_stream_->CancelOutstandingCallbacks();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 170
170 crypto_stream_->SendServerConfigUpdate(&cached_network_params); 171 crypto_stream_->SendServerConfigUpdate(&cached_network_params);
171 172
172 connection()->OnSendConnectionState(cached_network_params); 173 connection()->OnSendConnectionState(cached_network_params);
173 174
174 last_scup_time_ = now; 175 last_scup_time_ = now;
175 last_scup_sequence_number_ = 176 last_scup_sequence_number_ =
176 connection()->sequence_number_of_last_sent_packet(); 177 connection()->sequence_number_of_last_sent_packet();
177 } 178 }
178 179
179 bool QuicServerSession::ShouldCreateIncomingDataStream(QuicStreamId id) { 180 bool QuicServerSession::ShouldCreateIncomingDynamicStream(QuicStreamId id) {
180 if (!connection()->connected()) { 181 if (!connection()->connected()) {
181 LOG(DFATAL) << "ShouldCreateIncomingDataStream called when disconnected"; 182 LOG(DFATAL) << "ShouldCreateIncomingDynamicStream called when disconnected";
182 return false; 183 return false;
183 } 184 }
184 185
185 if (id % 2 == 0) { 186 if (id % 2 == 0) {
186 DVLOG(1) << "Invalid incoming even stream_id:" << id; 187 DVLOG(1) << "Invalid incoming even stream_id:" << id;
187 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); 188 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID);
188 return false; 189 return false;
189 } 190 }
190 if (GetNumOpenStreams() >= get_max_open_streams()) { 191 if (GetNumOpenStreams() >= get_max_open_streams()) {
191 DVLOG(1) << "Failed to create a new incoming stream with id:" << id 192 DVLOG(1) << "Failed to create a new incoming stream with id:" << id
192 << " Already " << GetNumOpenStreams() << " streams open (max " 193 << " Already " << GetNumOpenStreams() << " streams open (max "
193 << get_max_open_streams() << ")."; 194 << get_max_open_streams() << ").";
194 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); 195 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS);
195 return false; 196 return false;
196 } 197 }
197 return true; 198 return true;
198 } 199 }
199 200
200 QuicDataStream* QuicServerSession::CreateIncomingDataStream( 201 QuicDataStream* QuicServerSession::CreateIncomingDynamicStream(
201 QuicStreamId id) { 202 QuicStreamId id) {
202 if (!ShouldCreateIncomingDataStream(id)) { 203 if (!ShouldCreateIncomingDynamicStream(id)) {
203 return nullptr; 204 return nullptr;
204 } 205 }
205 206
206 return new QuicSpdyServerStream(id, this); 207 return new QuicSpdyServerStream(id, this);
207 } 208 }
208 209
209 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { 210 QuicDataStream* QuicServerSession::CreateOutgoingDynamicStream() {
210 DLOG(ERROR) << "Server push not yet supported"; 211 DLOG(ERROR) << "Server push not yet supported";
211 return nullptr; 212 return nullptr;
212 } 213 }
213 214
214 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { 215 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() {
215 return crypto_stream_.get(); 216 return crypto_stream_.get();
216 } 217 }
217 218
218 } // namespace tools 219 } // namespace tools
219 } // namespace net 220 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_session.h ('k') | net/tools/quic/quic_server_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698