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

Unified Diff: net/quic/quic_connection.cc

Issue 304293009: Cleanup in QuicConnection to always cancel the send alarm when CanWrite (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 | « no previous file | 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 c36010b4604aca2d846687d755b364a30a619974..7b9a6b3a5f414d2755264e1c363f789a2191465c 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -949,15 +949,8 @@ void QuicConnection::MaybeSendInResponseToPacket() {
// Now that we have received an ack, we might be able to send packets which
// are queued locally, or drain streams which are blocked.
- QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend(
- time_of_last_received_packet_, NOT_RETRANSMISSION,
- HAS_RETRANSMITTABLE_DATA);
- if (delay.IsZero()) {
- send_alarm_->Cancel();
- WriteIfNotBlocked();
- } else if (!delay.IsInfinite()) {
- send_alarm_->Cancel();
- send_alarm_->Set(time_of_last_received_packet_.Add(delay));
+ if (CanWrite(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA)) {
+ OnCanWrite();
}
}
@@ -1298,15 +1291,7 @@ bool QuicConnection::CanWrite(TransmissionType transmission_type,
return false;
}
- // TODO(rch): consider removing this check so that if an ACK comes in
- // before the alarm goes it, we might be able send out a packet.
- // This check assumes that if the send alarm is set, it applies equally to all
- // types of transmissions.
- if (send_alarm_->IsSet()) {
- DVLOG(1) << "Send alarm set. Not sending.";
- return false;
- }
-
+ send_alarm_->Cancel();
QuicTime now = clock_->Now();
QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend(
now, transmission_type, retransmittable);
@@ -1316,7 +1301,6 @@ bool QuicConnection::CanWrite(TransmissionType transmission_type,
// If the scheduler requires a delay, then we can not send this packet now.
if (!delay.IsZero()) {
- send_alarm_->Cancel();
send_alarm_->Set(now.Add(delay));
DVLOG(1) << "Delaying sending.";
return false;
« no previous file with comments | « no previous file | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698