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

Unified Diff: net/quic/reliable_quic_stream.cc

Issue 312553003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/reliable_quic_stream.h ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/reliable_quic_stream.cc
diff --git a/net/quic/reliable_quic_stream.cc b/net/quic/reliable_quic_stream.cc
index aefdb4126be6e4bd19b1344a6f0505229a75b7c5..64d8aaef67d949dd10cdf480835c0e64b428364d 100644
--- a/net/quic/reliable_quic_stream.cc
+++ b/net/quic/reliable_quic_stream.cc
@@ -151,7 +151,11 @@ bool ReliableQuicStream::OnStreamFrame(const QuicStreamFrame& frame) {
}
// This count include duplicate data received.
- stream_bytes_read_ += frame.data.TotalBufferSize();
+ size_t frame_payload_size = frame.data.TotalBufferSize();
+ stream_bytes_read_ += frame_payload_size;
+
+ // Flow control is interested in tracking highest received offset.
+ MaybeIncreaseHighestReceivedOffset(frame.offset + frame_payload_size);
bool accepted = sequencer_.OnStreamFrame(frame);
@@ -160,16 +164,10 @@ bool ReliableQuicStream::OnStreamFrame(const QuicStreamFrame& frame) {
session_->connection()->SendConnectionClose(QUIC_FLOW_CONTROL_ERROR);
return false;
}
- MaybeSendWindowUpdate();
return accepted;
}
-void ReliableQuicStream::MaybeSendWindowUpdate() {
- flow_controller_.MaybeSendWindowUpdate(session()->connection());
- connection_flow_controller_->MaybeSendWindowUpdate(session()->connection());
-}
-
int ReliableQuicStream::num_frames_received() const {
return sequencer_.num_frames_received();
}
@@ -179,6 +177,8 @@ int ReliableQuicStream::num_duplicate_frames_received() const {
}
void ReliableQuicStream::OnStreamReset(const QuicRstStreamFrame& frame) {
+ MaybeIncreaseHighestReceivedOffset(frame.byte_offset);
+
stream_error_ = frame.error_code;
CloseWriteSide();
CloseReadSide();
@@ -436,17 +436,18 @@ void ReliableQuicStream::OnWindowUpdateFrame(
}
}
-void ReliableQuicStream::AddBytesBuffered(uint64 bytes) {
- if (flow_controller_.IsEnabled()) {
- flow_controller_.AddBytesBuffered(bytes);
- connection_flow_controller_->AddBytesBuffered(bytes);
- }
-}
-
-void ReliableQuicStream::RemoveBytesBuffered(uint64 bytes) {
+void ReliableQuicStream::MaybeIncreaseHighestReceivedOffset(uint64 new_offset) {
if (flow_controller_.IsEnabled()) {
- flow_controller_.RemoveBytesBuffered(bytes);
- connection_flow_controller_->RemoveBytesBuffered(bytes);
+ uint64 increment =
+ new_offset - flow_controller_.highest_received_byte_offset();
+ if (flow_controller_.UpdateHighestReceivedOffset(new_offset)) {
+ // If |new_offset| increased the stream flow controller's highest received
+ // offset, then we need to increase the connection flow controller's value
+ // by the incremental difference.
+ connection_flow_controller_->UpdateHighestReceivedOffset(
+ connection_flow_controller_->highest_received_byte_offset() +
+ increment);
+ }
}
}
@@ -460,7 +461,10 @@ void ReliableQuicStream::AddBytesSent(uint64 bytes) {
void ReliableQuicStream::AddBytesConsumed(uint64 bytes) {
if (flow_controller_.IsEnabled()) {
flow_controller_.AddBytesConsumed(bytes);
+ flow_controller_.MaybeSendWindowUpdate(session()->connection());
+
connection_flow_controller_->AddBytesConsumed(bytes);
+ connection_flow_controller_->MaybeSendWindowUpdate(session()->connection());
}
}
« no previous file with comments | « net/quic/reliable_quic_stream.h ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698