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

Unified Diff: net/quic/chromium/quic_http_stream.cc

Issue 2677883002: QUIC: Do not count the duplicate received bytes in GetTotalReceivedBytes (Closed)
Patch Set: use sequencer 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_http_stream.cc
diff --git a/net/quic/chromium/quic_http_stream.cc b/net/quic/chromium/quic_http_stream.cc
index c00c6492351f971ab75356b4cded0bf37c636dde..f824b46441402ebfab994207b3de7fe8fe1f8345 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -19,6 +19,7 @@
#include "net/log/net_log_source.h"
#include "net/quic/chromium/quic_http_utils.h"
#include "net/quic/core/quic_client_promised_info.h"
+#include "net/quic/core/quic_stream_sequencer.h"
#include "net/quic/core/quic_utils.h"
#include "net/quic/core/spdy_utils.h"
#include "net/spdy/spdy_frame_builder.h"
@@ -376,7 +377,10 @@ int64_t QuicHttpStream::GetTotalReceivedBytes() const {
// bytes. Change this to include QUIC overhead as well.
int64_t total_received_bytes = headers_bytes_received_;
if (stream_) {
- total_received_bytes += stream_->stream_bytes_read();
+ DCHECK_LE(stream_->sequencer()->NumBytesConsumed(),
+ stream_->stream_bytes_read());
+ // Only count the uniquely received bytes.
+ total_received_bytes += stream_->sequencer()->NumBytesConsumed();
} else {
total_received_bytes += closed_stream_received_bytes_;
}
@@ -812,7 +816,10 @@ void QuicHttpStream::ResetStream() {
}
if (!stream_)
return;
- closed_stream_received_bytes_ = stream_->stream_bytes_read();
+ DCHECK_LE(stream_->sequencer()->NumBytesConsumed(),
+ stream_->stream_bytes_read());
+ // Only count the uniquely received bytes.
+ closed_stream_received_bytes_ = stream_->sequencer()->NumBytesConsumed();
closed_stream_sent_bytes_ = stream_->stream_bytes_written();
closed_is_first_stream_ = stream_->IsFirstStream();
stream_ = nullptr;
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698