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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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_server_session.h ('k') | net/quic/quic_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/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_flow_controller.h" 10 #include "net/quic/quic_flow_controller.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 config_(config), 102 config_(config),
103 max_open_streams_(config_.MaxStreamsPerConnection()), 103 max_open_streams_(config_.MaxStreamsPerConnection()),
104 next_stream_id_(is_server() ? 2 : 5), 104 next_stream_id_(is_server() ? 2 : 5),
105 largest_peer_created_stream_id_(0), 105 largest_peer_created_stream_id_(0),
106 error_(QUIC_NO_ERROR), 106 error_(QUIC_NO_ERROR),
107 goaway_received_(false), 107 goaway_received_(false),
108 goaway_sent_(false), 108 goaway_sent_(false),
109 has_pending_handshake_(false) { 109 has_pending_handshake_(false) {
110 if (connection_->version() == QUIC_VERSION_19) { 110 if (connection_->version() == QUIC_VERSION_19) {
111 flow_controller_.reset(new QuicFlowController( 111 flow_controller_.reset(new QuicFlowController(
112 connection_.get(), 0, is_server(), kDefaultFlowControlSendWindow, 112 connection_.get(), 0, is_server(), kMinimumFlowControlSendWindow,
113 config_.GetInitialFlowControlWindowToSend(), 113 config_.GetInitialFlowControlWindowToSend(),
114 config_.GetInitialFlowControlWindowToSend())); 114 config_.GetInitialFlowControlWindowToSend()));
115 } else { 115 } else {
116 flow_controller_.reset(new QuicFlowController( 116 flow_controller_.reset(new QuicFlowController(
117 connection_.get(), 0, is_server(), kDefaultFlowControlSendWindow, 117 connection_.get(), 0, is_server(), kMinimumFlowControlSendWindow,
118 config_.GetInitialSessionFlowControlWindowToSend(), 118 config_.GetInitialSessionFlowControlWindowToSend(),
119 config_.GetInitialSessionFlowControlWindowToSend())); 119 config_.GetInitialSessionFlowControlWindowToSend()));
120 } 120 }
121 } 121 }
122 122
123 void QuicSession::InitializeSession() { 123 void QuicSession::InitializeSession() {
124 connection_->set_visitor(visitor_shim_.get()); 124 connection_->set_visitor(visitor_shim_.get());
125 connection_->SetFromConfig(config_); 125 connection_->SetFromConfig(config_);
126 headers_stream_.reset(new QuicHeadersStream(this)); 126 headers_stream_.reset(new QuicHeadersStream(this));
127 } 127 }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 OnNewStreamFlowControlWindow( 502 OnNewStreamFlowControlWindow(
503 config_.ReceivedInitialStreamFlowControlWindowBytes()); 503 config_.ReceivedInitialStreamFlowControlWindowBytes());
504 } 504 }
505 if (config_.HasReceivedInitialSessionFlowControlWindowBytes()) { 505 if (config_.HasReceivedInitialSessionFlowControlWindowBytes()) {
506 OnNewSessionFlowControlWindow( 506 OnNewSessionFlowControlWindow(
507 config_.ReceivedInitialSessionFlowControlWindowBytes()); 507 config_.ReceivedInitialSessionFlowControlWindowBytes());
508 } 508 }
509 } 509 }
510 510
511 void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window) { 511 void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window) {
512 if (new_window < kDefaultFlowControlSendWindow) { 512 if (new_window < kMinimumFlowControlSendWindow) {
513 LOG(ERROR) 513 LOG(ERROR) << "Peer sent us an invalid stream flow control send window: "
514 << "Peer sent us an invalid stream flow control send window: " 514 << new_window
515 << new_window << ", below default: " << kDefaultFlowControlSendWindow; 515 << ", below default: " << kMinimumFlowControlSendWindow;
516 if (connection_->connected()) { 516 if (connection_->connected()) {
517 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); 517 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW);
518 } 518 }
519 return; 519 return;
520 } 520 }
521 521
522 // Inform all existing streams about the new window. 522 // Inform all existing streams about the new window.
523 if (connection_->version() >= QUIC_VERSION_21) { 523 if (connection_->version() >= QUIC_VERSION_21) {
524 GetCryptoStream()->UpdateSendWindowOffset(new_window); 524 GetCryptoStream()->UpdateSendWindowOffset(new_window);
525 headers_stream_->UpdateSendWindowOffset(new_window); 525 headers_stream_->UpdateSendWindowOffset(new_window);
526 } 526 }
527 for (DataStreamMap::iterator it = stream_map_.begin(); 527 for (DataStreamMap::iterator it = stream_map_.begin();
528 it != stream_map_.end(); ++it) { 528 it != stream_map_.end(); ++it) {
529 it->second->UpdateSendWindowOffset(new_window); 529 it->second->UpdateSendWindowOffset(new_window);
530 } 530 }
531 } 531 }
532 532
533 void QuicSession::OnNewSessionFlowControlWindow(QuicStreamOffset new_window) { 533 void QuicSession::OnNewSessionFlowControlWindow(QuicStreamOffset new_window) {
534 if (new_window < kDefaultFlowControlSendWindow) { 534 if (new_window < kMinimumFlowControlSendWindow) {
535 LOG(ERROR) 535 LOG(ERROR) << "Peer sent us an invalid session flow control send window: "
536 << "Peer sent us an invalid session flow control send window: " 536 << new_window
537 << new_window << ", below default: " << kDefaultFlowControlSendWindow; 537 << ", below default: " << kMinimumFlowControlSendWindow;
538 if (connection_->connected()) { 538 if (connection_->connected()) {
539 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); 539 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW);
540 } 540 }
541 return; 541 return;
542 } 542 }
543 543
544 flow_controller_->UpdateSendWindowOffset(new_window); 544 flow_controller_->UpdateSendWindowOffset(new_window);
545 } 545 }
546 546
547 void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { 547 void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 for (DataStreamMap::iterator it = stream_map_.begin(); 778 for (DataStreamMap::iterator it = stream_map_.begin();
779 it != stream_map_.end(); ++it) { 779 it != stream_map_.end(); ++it) {
780 if (it->second->flow_controller()->IsBlocked()) { 780 if (it->second->flow_controller()->IsBlocked()) {
781 return true; 781 return true;
782 } 782 }
783 } 783 }
784 return false; 784 return false;
785 } 785 }
786 786
787 } // namespace net 787 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_server_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698