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; |