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

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

Issue 2702383002: More improvements to logs. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | net/quic/core/quic_stream.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 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 <cstdint> 7 #include <cstdint>
8 8
9 #include "net/quic/core/quic_connection.h" 9 #include "net/quic/core/quic_connection.h"
10 #include "net/quic/core/quic_packets.h" 10 #include "net/quic/core/quic_packets.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 << ", setting initial receive window offset to: " 47 << ", setting initial receive window offset to: "
48 << receive_window_offset_ 48 << receive_window_offset_
49 << ", max receive window to: " << receive_window_size_ 49 << ", max receive window to: " << receive_window_size_
50 << ", max receive window limit to: " 50 << ", max receive window limit to: "
51 << receive_window_size_limit_ 51 << receive_window_size_limit_
52 << ", setting send window offset to: " << send_window_offset_; 52 << ", setting send window offset to: " << send_window_offset_;
53 } 53 }
54 54
55 void QuicFlowController::AddBytesConsumed(QuicByteCount bytes_consumed) { 55 void QuicFlowController::AddBytesConsumed(QuicByteCount bytes_consumed) {
56 bytes_consumed_ += bytes_consumed; 56 bytes_consumed_ += bytes_consumed;
57 QUIC_DVLOG(1) << ENDPOINT << "Stream " << id_ 57 QUIC_DVLOG(1) << ENDPOINT << "Stream " << id_ << " consumed "
58 << " consumed: " << bytes_consumed_; 58 << bytes_consumed_ << " bytes.";
59 59
60 MaybeSendWindowUpdate(); 60 MaybeSendWindowUpdate();
61 } 61 }
62 62
63 bool QuicFlowController::UpdateHighestReceivedOffset( 63 bool QuicFlowController::UpdateHighestReceivedOffset(
64 QuicStreamOffset new_offset) { 64 QuicStreamOffset new_offset) {
65 // Only update if offset has increased. 65 // Only update if offset has increased.
66 if (new_offset <= highest_received_byte_offset_) { 66 if (new_offset <= highest_received_byte_offset_) {
67 return false; 67 return false;
68 } 68 }
69 69
70 QUIC_DVLOG(1) << ENDPOINT << "Stream " << id_ 70 QUIC_DVLOG(1) << ENDPOINT << "Stream " << id_
71 << " highest byte offset increased from: " 71 << " highest byte offset increased from "
72 << highest_received_byte_offset_ << " to " << new_offset; 72 << highest_received_byte_offset_ << " to " << new_offset;
73 highest_received_byte_offset_ = new_offset; 73 highest_received_byte_offset_ = new_offset;
74 return true; 74 return true;
75 } 75 }
76 76
77 void QuicFlowController::AddBytesSent(QuicByteCount bytes_sent) { 77 void QuicFlowController::AddBytesSent(QuicByteCount bytes_sent) {
78 if (bytes_sent_ + bytes_sent > send_window_offset_) { 78 if (bytes_sent_ + bytes_sent > send_window_offset_) {
79 QUIC_BUG << ENDPOINT << "Stream " << id_ << " Trying to send an extra " 79 QUIC_BUG << ENDPOINT << "Stream " << id_ << " Trying to send an extra "
80 << bytes_sent << " bytes, when bytes_sent = " << bytes_sent_ 80 << bytes_sent << " bytes, when bytes_sent = " << bytes_sent_
81 << ", and send_window_offset_ = " << send_window_offset_; 81 << ", and send_window_offset_ = " << send_window_offset_;
82 bytes_sent_ = send_window_offset_; 82 bytes_sent_ = send_window_offset_;
83 83
84 // This is an error on our side, close the connection as soon as possible. 84 // This is an error on our side, close the connection as soon as possible.
85 connection_->CloseConnection( 85 connection_->CloseConnection(
86 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA, 86 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA,
87 QuicStrCat(send_window_offset_ - (bytes_sent_ + bytes_sent), 87 QuicStrCat(send_window_offset_ - (bytes_sent_ + bytes_sent),
88 "bytes over send window offset"), 88 "bytes over send window offset"),
89 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 89 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
90 return; 90 return;
91 } 91 }
92 92
93 bytes_sent_ += bytes_sent; 93 bytes_sent_ += bytes_sent;
94 QUIC_DVLOG(1) << ENDPOINT << "Stream " << id_ << " sent: " << bytes_sent_; 94 QUIC_DVLOG(1) << ENDPOINT << "Stream " << id_ << " sent " << bytes_sent_
95 << " bytes.";
95 } 96 }
96 97
97 bool QuicFlowController::FlowControlViolation() { 98 bool QuicFlowController::FlowControlViolation() {
98 if (highest_received_byte_offset_ > receive_window_offset_) { 99 if (highest_received_byte_offset_ > receive_window_offset_) {
99 QUIC_DLOG(INFO) << ENDPOINT << "Flow control violation on stream " << id_ 100 QUIC_DLOG(INFO) << ENDPOINT << "Flow control violation on stream " << id_
100 << ", receive window offset: " << receive_window_offset_ 101 << ", receive window offset: " << receive_window_offset_
101 << ", highest received byte offset: " 102 << ", highest received byte offset: "
102 << highest_received_byte_offset_; 103 << highest_received_byte_offset_;
103 return true; 104 return true;
104 } 105 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (receive_window_size_ != receive_window_offset_) { 273 if (receive_window_size_ != receive_window_offset_) {
273 QUIC_BUG << "receive_window_size_:" << receive_window_size_ 274 QUIC_BUG << "receive_window_size_:" << receive_window_size_
274 << " != receive_window_offset:" << receive_window_offset_; 275 << " != receive_window_offset:" << receive_window_offset_;
275 return; 276 return;
276 } 277 }
277 receive_window_size_ = size; 278 receive_window_size_ = size;
278 receive_window_offset_ = size; 279 receive_window_offset_ = size;
279 } 280 }
280 281
281 } // namespace net 282 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/core/quic_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698