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

Unified Diff: net/quic/quic_connection.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index 5fdc4b9528d0afd62a74bbc5bfd34daa9a09dcf6..07ef30c69f60199c036d041f3a90ea9454c7df90 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -1070,13 +1070,9 @@ QuicConsumedData QuicConnection::SendStreamData(
QuicAckNotifier::DelegateInterface* delegate) {
if (!fin && data.Empty()) {
LOG(DFATAL) << "Attempt to send empty stream frame";
- }
-
- // This notifier will be owned by the AckNotifierManager (or deleted below if
- // no data or FIN was consumed).
- QuicAckNotifier* notifier = nullptr;
- if (delegate) {
- notifier = new QuicAckNotifier(delegate);
+ if (FLAGS_quic_empty_data_no_fin_early_return) {
+ return QuicConsumedData(0, false);
+ }
}
// Opportunistically bundle an ack with every outgoing packet.
@@ -1093,17 +1089,8 @@ QuicConsumedData QuicConnection::SendStreamData(
// also if there is possibility of revival. Only bundle an ack if there's no
// processing left that may cause received_info_ to change.
ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK);
- QuicConsumedData consumed_data =
- packet_generator_.ConsumeData(id, data, offset, fin, fec_protection,
- notifier);
-
- if (notifier &&
- (consumed_data.bytes_consumed == 0 && !consumed_data.fin_consumed)) {
- // No data was consumed, nor was a fin consumed, so delete the notifier.
- delete notifier;
- }
-
- return consumed_data;
+ return packet_generator_.ConsumeData(id, data, offset, fin, fec_protection,
+ delegate);
}
void QuicConnection::SendRstStream(QuicStreamId id,
@@ -1130,11 +1117,30 @@ void QuicConnection::SendBlocked(QuicStreamId id) {
}
const QuicConnectionStats& QuicConnection::GetStats() {
- // Update rtt and estimated bandwidth.
- stats_.min_rtt_us =
- sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds();
- stats_.srtt_us =
- sent_packet_manager_.GetRttStats()->smoothed_rtt().ToMicroseconds();
+ if (!FLAGS_quic_use_initial_rtt_for_stats) {
+ stats_.min_rtt_us =
+ sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds();
+ stats_.srtt_us =
+ sent_packet_manager_.GetRttStats()->smoothed_rtt().ToMicroseconds();
+ } else {
+ const RttStats* rtt_stats = sent_packet_manager_.GetRttStats();
+
+ // Update rtt and estimated bandwidth.
+ QuicTime::Delta min_rtt = rtt_stats->min_rtt();
+ if (min_rtt.IsZero()) {
+ // If min RTT has not been set, use initial RTT instead.
+ min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
+ }
+ stats_.min_rtt_us = min_rtt.ToMicroseconds();
+
+ QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
+ if (srtt.IsZero()) {
+ // If SRTT has not been set, use initial RTT instead.
+ srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
+ }
+ stats_.srtt_us = srtt.ToMicroseconds();
+ }
+
stats_.estimated_bandwidth = sent_packet_manager_.BandwidthEstimate();
stats_.max_packet_size = packet_generator_.max_packet_length();
return stats_;
@@ -1598,6 +1604,16 @@ void QuicConnection::OnCongestionWindowChange() {
visitor_->OnCongestionWindowChange(clock_->ApproximateNow());
}
+void QuicConnection::OnRttChange() {
+ // Uses the connection's smoothed RTT. If zero, uses initial_rtt.
+ QuicTime::Delta rtt = sent_packet_manager_.GetRttStats()->smoothed_rtt();
+ if (rtt.IsZero()) {
+ rtt = QuicTime::Delta::FromMicroseconds(
+ sent_packet_manager_.GetRttStats()->initial_rtt_us());
+ }
+ packet_generator_.OnRttChange(rtt);
+}
+
void QuicConnection::OnHandshakeComplete() {
sent_packet_manager_.SetHandshakeConfirmed();
// The client should immediately ack the SHLO to confirm the handshake is
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698