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

Side by Side Diff: net/quic/quic_connection.cc

Issue 1531543004: Fix a bug protected by gfe2_reloadable_flag_quic_respect_send_alarm where acks would not be sent im… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110021608
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 if (last_header_.packet_number <= largest_seen_packet_with_ack_) { 703 if (last_header_.packet_number <= largest_seen_packet_with_ack_) {
704 DVLOG(1) << ENDPOINT << "Received an old ack frame: ignoring"; 704 DVLOG(1) << ENDPOINT << "Received an old ack frame: ignoring";
705 return true; 705 return true;
706 } 706 }
707 707
708 if (!ValidateAckFrame(incoming_ack)) { 708 if (!ValidateAckFrame(incoming_ack)) {
709 SendConnectionClose(QUIC_INVALID_ACK_DATA); 709 SendConnectionClose(QUIC_INVALID_ACK_DATA);
710 return false; 710 return false;
711 } 711 }
712 712
713 if (FLAGS_quic_respect_send_alarm && send_alarm_->IsSet()) { 713 if (FLAGS_quic_respect_send_alarm2 && send_alarm_->IsSet()) {
714 send_alarm_->Cancel(); 714 send_alarm_->Cancel();
715 } 715 }
716 ProcessAckFrame(incoming_ack); 716 ProcessAckFrame(incoming_ack);
717 if (incoming_ack.is_truncated) { 717 if (incoming_ack.is_truncated) {
718 should_last_packet_instigate_acks_ = true; 718 should_last_packet_instigate_acks_ = true;
719 } 719 }
720 // If the peer is still waiting for a packet that we are no longer planning to 720 // If the peer is still waiting for a packet that we are no longer planning to
721 // send, send an ack to raise the high water mark. 721 // send, send an ack to raise the high water mark.
722 if (!incoming_ack.missing_packets.Empty() && 722 if (!incoming_ack.missing_packets.Empty() &&
723 GetLeastUnacked() > incoming_ack.missing_packets.Min()) { 723 GetLeastUnacked() > incoming_ack.missing_packets.Min()) {
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 bool QuicConnection::CanWrite(HasRetransmittableData retransmittable) { 1504 bool QuicConnection::CanWrite(HasRetransmittableData retransmittable) {
1505 if (!connected_) { 1505 if (!connected_) {
1506 return false; 1506 return false;
1507 } 1507 }
1508 1508
1509 if (writer_->IsWriteBlocked()) { 1509 if (writer_->IsWriteBlocked()) {
1510 visitor_->OnWriteBlocked(); 1510 visitor_->OnWriteBlocked();
1511 return false; 1511 return false;
1512 } 1512 }
1513 1513
1514 // If the send alarm is set, wait for it to fire. 1514 if (FLAGS_quic_respect_send_alarm2) {
1515 if (FLAGS_quic_respect_send_alarm && send_alarm_->IsSet()) { 1515 // Allow acks to be sent immediately.
1516 return false; 1516 // TODO(ianswett): Remove retransmittable from
1517 // SendAlgorithmInterface::TimeUntilSend.
1518 if (retransmittable == NO_RETRANSMITTABLE_DATA) {
1519 return true;
1520 }
1521 // If the send alarm is set, wait for it to fire.
1522 if (send_alarm_->IsSet()) {
1523 return false;
1524 }
1517 } 1525 }
1518 1526
1519 QuicTime now = clock_->Now(); 1527 QuicTime now = clock_->Now();
1520 QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend( 1528 QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend(
1521 now, retransmittable); 1529 now, retransmittable);
1522 if (delay.IsInfinite()) { 1530 if (delay.IsInfinite()) {
1523 send_alarm_->Cancel(); 1531 send_alarm_->Cancel();
1524 return false; 1532 return false;
1525 } 1533 }
1526 1534
1527 // If the scheduler requires a delay, then we can not send this packet now. 1535 // If the scheduler requires a delay, then we can not send this packet now.
1528 if (!delay.IsZero()) { 1536 if (!delay.IsZero()) {
1529 send_alarm_->Update(now.Add(delay), QuicTime::Delta::FromMilliseconds(1)); 1537 send_alarm_->Update(now.Add(delay), QuicTime::Delta::FromMilliseconds(1));
1530 DVLOG(1) << ENDPOINT << "Delaying sending " << delay.ToMilliseconds() 1538 DVLOG(1) << ENDPOINT << "Delaying sending " << delay.ToMilliseconds()
1531 << "ms"; 1539 << "ms";
1532 return false; 1540 return false;
1533 } 1541 }
1534 if (!FLAGS_quic_respect_send_alarm) { 1542 if (!FLAGS_quic_respect_send_alarm2) {
1535 send_alarm_->Cancel(); 1543 send_alarm_->Cancel();
1536 } 1544 }
1537 return true; 1545 return true;
1538 } 1546 }
1539 1547
1540 bool QuicConnection::WritePacket(QueuedPacket* packet) { 1548 bool QuicConnection::WritePacket(QueuedPacket* packet) {
1541 if (!WritePacketInner(packet)) { 1549 if (!WritePacketInner(packet)) {
1542 return false; 1550 return false;
1543 } 1551 }
1544 delete packet->serialized_packet.retransmittable_frames; 1552 delete packet->serialized_packet.retransmittable_frames;
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 if (!already_in_batch_mode_) { 2267 if (!already_in_batch_mode_) {
2260 DVLOG(1) << "Entering Batch Mode."; 2268 DVLOG(1) << "Entering Batch Mode.";
2261 connection_->packet_generator_.StartBatchOperations(); 2269 connection_->packet_generator_.StartBatchOperations();
2262 } 2270 }
2263 // Bundle an ack if the alarm is set or with every second packet if we need to 2271 // Bundle an ack if the alarm is set or with every second packet if we need to
2264 // raise the peer's least unacked. 2272 // raise the peer's least unacked.
2265 bool ack_pending = 2273 bool ack_pending =
2266 connection_->ack_alarm_->IsSet() || connection_->stop_waiting_count_ > 1; 2274 connection_->ack_alarm_->IsSet() || connection_->stop_waiting_count_ > 1;
2267 if (send_ack == SEND_ACK || (send_ack == BUNDLE_PENDING_ACK && ack_pending)) { 2275 if (send_ack == SEND_ACK || (send_ack == BUNDLE_PENDING_ACK && ack_pending)) {
2268 DVLOG(1) << "Bundling ack with outgoing packet."; 2276 DVLOG(1) << "Bundling ack with outgoing packet.";
2269 DCHECK(send_ack == SEND_ACK || connection_->ack_frame_updated()); 2277 DCHECK(send_ack == SEND_ACK || connection_->ack_frame_updated() ||
2278 connection_->stop_waiting_count_ > 1);
2270 connection_->SendAck(); 2279 connection_->SendAck();
2271 } 2280 }
2272 } 2281 }
2273 2282
2274 QuicConnection::ScopedPacketBundler::~ScopedPacketBundler() { 2283 QuicConnection::ScopedPacketBundler::~ScopedPacketBundler() {
2275 if (connection_ == nullptr) { 2284 if (connection_ == nullptr) {
2276 return; 2285 return;
2277 } 2286 }
2278 // If we changed the generator's batch state, restore original batch state. 2287 // If we changed the generator's batch state, restore original batch state.
2279 if (!already_in_batch_mode_) { 2288 if (!already_in_batch_mode_) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 2407
2399 bool QuicConnection::ack_frame_updated() const { 2408 bool QuicConnection::ack_frame_updated() const {
2400 return received_packet_manager_.ack_frame_updated(); 2409 return received_packet_manager_.ack_frame_updated();
2401 } 2410 }
2402 2411
2403 void QuicConnection::set_ack_frame_updated(bool updated) { 2412 void QuicConnection::set_ack_frame_updated(bool updated) {
2404 received_packet_manager_.set_ack_frame_updated(updated); 2413 received_packet_manager_.set_ack_frame_updated(updated);
2405 } 2414 }
2406 2415
2407 } // namespace net 2416 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698