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

Side by Side Diff: net/quic/core/quic_flow_controller.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: correct quic_client_bin.cc Created 3 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/core/quic_flow_controller.h" 5 #include "net/quic/core/quic_flow_controller.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "net/quic/core/quic_bug_tracker.h" 8 #include "net/quic/core/quic_bug_tracker.h"
9 #include "net/quic/core/quic_connection.h" 9 #include "net/quic/core/quic_connection.h"
10 #include "net/quic/core/quic_flags.h" 10 #include "net/quic/core/quic_flags.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void QuicFlowController::AddBytesSent(QuicByteCount bytes_sent) { 70 void QuicFlowController::AddBytesSent(QuicByteCount bytes_sent) {
71 if (bytes_sent_ + bytes_sent > send_window_offset_) { 71 if (bytes_sent_ + bytes_sent > send_window_offset_) {
72 QUIC_BUG << ENDPOINT << "Stream " << id_ << " Trying to send an extra " 72 QUIC_BUG << ENDPOINT << "Stream " << id_ << " Trying to send an extra "
73 << bytes_sent << " bytes, when bytes_sent = " << bytes_sent_ 73 << bytes_sent << " bytes, when bytes_sent = " << bytes_sent_
74 << ", and send_window_offset_ = " << send_window_offset_; 74 << ", and send_window_offset_ = " << send_window_offset_;
75 bytes_sent_ = send_window_offset_; 75 bytes_sent_ = send_window_offset_;
76 76
77 // This is an error on our side, close the connection as soon as possible. 77 // This is an error on our side, close the connection as soon as possible.
78 connection_->CloseConnection( 78 connection_->CloseConnection(
79 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA, 79 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA,
80 base::StringPrintf( 80 QuicStrCat(send_window_offset_ - (bytes_sent_ + bytes_sent),
81 "%llu bytes over send window offset", 81 "bytes over send window offset"),
82 static_cast<unsigned long long>(send_window_offset_ -
83 (bytes_sent_ + bytes_sent)))
84 .c_str(),
85 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 82 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
86 return; 83 return;
87 } 84 }
88 85
89 bytes_sent_ += bytes_sent; 86 bytes_sent_ += bytes_sent;
90 DVLOG(1) << ENDPOINT << "Stream " << id_ << " sent: " << bytes_sent_; 87 DVLOG(1) << ENDPOINT << "Stream " << id_ << " sent: " << bytes_sent_;
91 } 88 }
92 89
93 bool QuicFlowController::FlowControlViolation() { 90 bool QuicFlowController::FlowControlViolation() {
94 if (highest_received_byte_offset_ > receive_window_offset_) { 91 if (highest_received_byte_offset_ > receive_window_offset_) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (receive_window_size_ != receive_window_offset_) { 244 if (receive_window_size_ != receive_window_offset_) {
248 QUIC_BUG << "receive_window_size_:" << receive_window_size_ 245 QUIC_BUG << "receive_window_size_:" << receive_window_size_
249 << " != receive_window_offset:" << receive_window_offset_; 246 << " != receive_window_offset:" << receive_window_offset_;
250 return; 247 return;
251 } 248 }
252 receive_window_size_ = size; 249 receive_window_size_ = size;
253 receive_window_offset_ = size; 250 receive_window_offset_ = size;
254 } 251 }
255 252
256 } // namespace net 253 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698