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

Unified Diff: net/quic/core/quic_connection.cc

Issue 2353063002: Only inform QUIC's SentPacketManager of packets that are actually sent, not those that failed to be… (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | net/quic/core/quic_connection_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_connection.cc
diff --git a/net/quic/core/quic_connection.cc b/net/quic/core/quic_connection.cc
index 91bf216ba0766b8d6a3002c7c6046d7dcd352894..6985d7dfd0d62c312a7d73d53be1a2d1f66371ad 100644
--- a/net/quic/core/quic_connection.cc
+++ b/net/quic/core/quic_connection.cc
@@ -1607,6 +1607,9 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
}
QuicPacketNumber packet_number = packet->packet_number;
+ // TODO(ianswett): Remove packet_number_of_last_sent_packet_ because it's
+ // redundant to SentPacketManager_->GetLargestPacket in most cases, and wrong
+ // for multipath.
DCHECK_LE(packet_number_of_last_sent_packet_, packet_number);
packet_number_of_last_sent_packet_ = packet_number;
@@ -1664,6 +1667,34 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
return false;
}
}
+
+ if (FLAGS_quic_only_track_sent_packets) {
+ // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the
+ // MTU discovery is permanently unsuccessful.
+ if (FLAGS_graceful_emsgsize_on_mtu_probe &&
+ result.status == WRITE_STATUS_ERROR &&
+ result.error_code == kMessageTooBigErrorCode &&
+ packet->retransmittable_frames.empty() &&
+ packet->encrypted_length > long_term_mtu_) {
+ mtu_discovery_target_ = 0;
+ mtu_discovery_alarm_->Cancel();
+ // The write failed, but the writer is not blocked, so return true.
+ return true;
+ }
+
+ if (result.status == WRITE_STATUS_ERROR) {
+ OnWriteError(result.error_code);
+ DLOG(ERROR) << ENDPOINT << "failed writing " << encrypted_length
+ << " from host "
+ << (self_address().address().empty()
+ ? " empty address "
+ : self_address().ToStringWithoutPort())
+ << " to address " << peer_address().ToString()
+ << " with error code " << result.error_code;
+ return false;
+ }
+ }
+
if (result.status != WRITE_STATUS_ERROR && debug_visitor_ != nullptr) {
// Pass the write result to the visitor.
debug_visitor_->OnPacketSent(*packet, packet->original_path_id,
@@ -1715,28 +1746,30 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
++stats_.packets_retransmitted;
}
- // In some cases, an MTU probe can cause ERR_MSG_TOO_BIG. This indicates that
- // the MTU discovery is permanently unsuccessful.
- if (FLAGS_graceful_emsgsize_on_mtu_probe &&
- result.status == WRITE_STATUS_ERROR &&
- result.error_code == kMessageTooBigErrorCode &&
- packet->retransmittable_frames.empty() &&
- packet->encrypted_length > long_term_mtu_) {
- mtu_discovery_target_ = 0;
- mtu_discovery_alarm_->Cancel();
- return true;
- }
+ if (!FLAGS_quic_only_track_sent_packets) {
+ // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the
+ // MTU discovery is permanently unsuccessful.
+ if (FLAGS_graceful_emsgsize_on_mtu_probe &&
+ result.status == WRITE_STATUS_ERROR &&
+ result.error_code == kMessageTooBigErrorCode &&
+ packet->retransmittable_frames.empty() &&
+ packet->encrypted_length > long_term_mtu_) {
+ mtu_discovery_target_ = 0;
+ mtu_discovery_alarm_->Cancel();
+ return true;
+ }
- if (result.status == WRITE_STATUS_ERROR) {
- OnWriteError(result.error_code);
- DLOG(ERROR) << ENDPOINT << "failed writing " << encrypted_length
- << " bytes "
- << " from host " << (self_address().address().empty()
- ? " empty address "
- : self_address().ToStringWithoutPort())
- << " to address " << peer_address().ToString()
- << " with error code " << result.error_code;
- return false;
+ if (result.status == WRITE_STATUS_ERROR) {
+ OnWriteError(result.error_code);
+ DLOG(ERROR) << ENDPOINT << "failed writing " << encrypted_length
+ << " from host "
+ << (self_address().address().empty()
+ ? " empty address "
+ : self_address().ToStringWithoutPort())
+ << " to address " << peer_address().ToString()
+ << " with error code " << result.error_code;
+ return false;
+ }
}
return true;
« no previous file with comments | « no previous file | net/quic/core/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698