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

Side by Side Diff: net/quic/quic_session.cc

Issue 530343003: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0828
Patch Set: Created 6 years, 3 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/quic/quic_sent_packet_manager_test.cc ('k') | net/quic/quic_unacked_packet_map.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/quic/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/crypto/proof_verifier.h" 8 #include "net/quic/crypto/proof_verifier.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"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // individual stream. 265 // individual stream.
266 DVLOG(1) << ENDPOINT 266 DVLOG(1) << ENDPOINT
267 << "Received connection level flow control window update with " 267 << "Received connection level flow control window update with "
268 "byte offset: " << frames[i].byte_offset; 268 "byte offset: " << frames[i].byte_offset;
269 if (flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { 269 if (flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) {
270 connection_window_updated = true; 270 connection_window_updated = true;
271 } 271 }
272 continue; 272 continue;
273 } 273 }
274 274
275 if (connection_->version() <= QUIC_VERSION_20 && 275 if (connection_->version() <= QUIC_VERSION_21 &&
276 (stream_id == kCryptoStreamId || stream_id == kHeadersStreamId)) { 276 (stream_id == kCryptoStreamId || stream_id == kHeadersStreamId)) {
277 DLOG(DFATAL) << "WindowUpdate for stream " << stream_id << " in version " 277 DLOG(DFATAL) << "WindowUpdate for stream " << stream_id << " in version "
278 << QuicVersionToString(connection_->version()); 278 << QuicVersionToString(connection_->version());
279 return; 279 return;
280 } 280 }
281 281
282 ReliableQuicStream* stream = GetStream(stream_id); 282 ReliableQuicStream* stream = GetStream(stream_id);
283 if (stream) { 283 if (stream) {
284 stream->OnWindowUpdateFrame(frames[i]); 284 stream->OnWindowUpdateFrame(frames[i]);
285 } 285 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Streams which were created before the SHLO was received (0-RTT 493 // Streams which were created before the SHLO was received (0-RTT
494 // requests) are now informed of the peer's initial flow control window. 494 // requests) are now informed of the peer's initial flow control window.
495 uint32 new_window = config_.ReceivedInitialFlowControlWindowBytes(); 495 uint32 new_window = config_.ReceivedInitialFlowControlWindowBytes();
496 OnNewStreamFlowControlWindow(new_window); 496 OnNewStreamFlowControlWindow(new_window);
497 OnNewSessionFlowControlWindow(new_window); 497 OnNewSessionFlowControlWindow(new_window);
498 } 498 }
499 499
500 return; 500 return;
501 } 501 }
502 502
503 // QUIC_VERSION_20 and higher can have independent stream and session flow 503 // QUIC_VERSION_21 and higher can have independent stream and session flow
504 // control windows. 504 // control windows.
505 if (config_.HasReceivedInitialStreamFlowControlWindowBytes()) { 505 if (config_.HasReceivedInitialStreamFlowControlWindowBytes()) {
506 // Streams which were created before the SHLO was received (0-RTT 506 // Streams which were created before the SHLO was received (0-RTT
507 // requests) are now informed of the peer's initial flow control window. 507 // requests) are now informed of the peer's initial flow control window.
508 OnNewStreamFlowControlWindow( 508 OnNewStreamFlowControlWindow(
509 config_.ReceivedInitialStreamFlowControlWindowBytes()); 509 config_.ReceivedInitialStreamFlowControlWindowBytes());
510 } 510 }
511 if (config_.HasReceivedInitialSessionFlowControlWindowBytes()) { 511 if (config_.HasReceivedInitialSessionFlowControlWindowBytes()) {
512 OnNewSessionFlowControlWindow( 512 OnNewSessionFlowControlWindow(
513 config_.ReceivedInitialSessionFlowControlWindowBytes()); 513 config_.ReceivedInitialSessionFlowControlWindowBytes());
514 } 514 }
515 } 515 }
516 516
517 void QuicSession::OnNewStreamFlowControlWindow(uint32 new_window) { 517 void QuicSession::OnNewStreamFlowControlWindow(uint32 new_window) {
518 if (new_window < kDefaultFlowControlSendWindow) { 518 if (new_window < kDefaultFlowControlSendWindow) {
519 LOG(ERROR) 519 LOG(ERROR)
520 << "Peer sent us an invalid stream flow control send window: " 520 << "Peer sent us an invalid stream flow control send window: "
521 << new_window << ", below default: " << kDefaultFlowControlSendWindow; 521 << new_window << ", below default: " << kDefaultFlowControlSendWindow;
522 if (connection_->connected()) { 522 if (connection_->connected()) {
523 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); 523 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW);
524 } 524 }
525 return; 525 return;
526 } 526 }
527 527
528 // Inform all existing streams about the new window. 528 // Inform all existing streams about the new window.
529 if (connection_->version() > QUIC_VERSION_20) { 529 if (connection_->version() >= QUIC_VERSION_21) {
530 GetCryptoStream()->flow_controller()->UpdateSendWindowOffset(new_window); 530 GetCryptoStream()->flow_controller()->UpdateSendWindowOffset(new_window);
531 headers_stream_->flow_controller()->UpdateSendWindowOffset(new_window); 531 headers_stream_->flow_controller()->UpdateSendWindowOffset(new_window);
532 } 532 }
533 for (DataStreamMap::iterator it = stream_map_.begin(); 533 for (DataStreamMap::iterator it = stream_map_.begin();
534 it != stream_map_.end(); ++it) { 534 it != stream_map_.end(); ++it) {
535 it->second->flow_controller()->UpdateSendWindowOffset(new_window); 535 it->second->flow_controller()->UpdateSendWindowOffset(new_window);
536 } 536 }
537 } 537 }
538 538
539 void QuicSession::OnNewSessionFlowControlWindow(uint32 new_window) { 539 void QuicSession::OnNewSessionFlowControlWindow(uint32 new_window) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 closed_streams_.clear(); 752 closed_streams_.clear();
753 } 753 }
754 754
755 void QuicSession::OnSuccessfulVersionNegotiation(const QuicVersion& version) { 755 void QuicSession::OnSuccessfulVersionNegotiation(const QuicVersion& version) {
756 if (version < QUIC_VERSION_19) { 756 if (version < QUIC_VERSION_19) {
757 flow_controller_->Disable(); 757 flow_controller_->Disable();
758 } 758 }
759 759
760 // Disable stream level flow control based on negotiated version. Streams may 760 // Disable stream level flow control based on negotiated version. Streams may
761 // have been created with a different version. 761 // have been created with a different version.
762 if (version <= QUIC_VERSION_20) { 762 if (version < QUIC_VERSION_21) {
763 GetCryptoStream()->flow_controller()->Disable(); 763 GetCryptoStream()->flow_controller()->Disable();
764 headers_stream_->flow_controller()->Disable(); 764 headers_stream_->flow_controller()->Disable();
765 } 765 }
766 for (DataStreamMap::iterator it = stream_map_.begin(); 766 for (DataStreamMap::iterator it = stream_map_.begin();
767 it != stream_map_.end(); ++it) { 767 it != stream_map_.end(); ++it) {
768 if (version <= QUIC_VERSION_16) { 768 if (version <= QUIC_VERSION_16) {
769 it->second->flow_controller()->Disable(); 769 it->second->flow_controller()->Disable();
770 } 770 }
771 } 771 }
772 } 772 }
773 773
774 } // namespace net 774 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager_test.cc ('k') | net/quic/quic_unacked_packet_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698