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

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

Issue 113123004: Change QUIC to only ack every other packet when there are no losses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 << last_goaway_frames_.size() << " goaways, " 652 << last_goaway_frames_.size() << " goaways, "
653 << last_rst_frames_.size() << " rsts, " 653 << last_rst_frames_.size() << " rsts, "
654 << last_close_frames_.size() << " closes, " 654 << last_close_frames_.size() << " closes, "
655 << last_stream_frames_.size() 655 << last_stream_frames_.size()
656 << " stream frames for " << last_header_.public_header.guid; 656 << " stream frames for " << last_header_.public_header.guid;
657 657
658 // Must called before ack processing, because processing acks removes entries 658 // Must called before ack processing, because processing acks removes entries
659 // from unacket_packets_, increasing the least_unacked. 659 // from unacket_packets_, increasing the least_unacked.
660 const bool last_packet_should_instigate_ack = ShouldLastPacketInstigateAck(); 660 const bool last_packet_should_instigate_ack = ShouldLastPacketInstigateAck();
661 661
662 // If we are missing any packets from the peer, then we want to ack 662 // If the incoming packet was missing, send an ack immediately.
663 // immediately. We need to check both before and after we process the 663 bool send_ack_immediately = received_packet_manager_.IsMissing(
664 // current packet because we want to ack immediately when we discover 664 last_header_.packet_sequence_number);
665 // a missing packet AND when we receive the last missing packet.
666 bool send_ack_immediately = received_packet_manager_.HasMissingPackets();
667 665
668 // Ensure the visitor can process the stream frames before recording and 666 // Ensure the visitor can process the stream frames before recording and
669 // processing the rest of the packet. 667 // processing the rest of the packet.
670 if (last_stream_frames_.empty() || 668 if (last_stream_frames_.empty() ||
671 visitor_->OnStreamFrames(last_stream_frames_)) { 669 visitor_->OnStreamFrames(last_stream_frames_)) {
672 received_packet_manager_.RecordPacketReceived(last_size_, 670 received_packet_manager_.RecordPacketReceived(last_size_,
673 last_header_, 671 last_header_,
674 time_of_last_received_packet_, 672 time_of_last_received_packet_,
675 last_packet_revived_); 673 last_packet_revived_);
676 for (size_t i = 0; i < last_stream_frames_.size(); ++i) { 674 for (size_t i = 0; i < last_stream_frames_.size(); ++i) {
(...skipping 14 matching lines...) Expand all
691 } 689 }
692 for (size_t i = 0; i < last_congestion_frames_.size(); ++i) { 690 for (size_t i = 0; i < last_congestion_frames_.size(); ++i) {
693 sent_packet_manager_.OnIncomingQuicCongestionFeedbackFrame( 691 sent_packet_manager_.OnIncomingQuicCongestionFeedbackFrame(
694 last_congestion_frames_[i], time_of_last_received_packet_); 692 last_congestion_frames_[i], time_of_last_received_packet_);
695 } 693 }
696 if (!last_close_frames_.empty()) { 694 if (!last_close_frames_.empty()) {
697 CloseConnection(last_close_frames_[0].error_code, true); 695 CloseConnection(last_close_frames_[0].error_code, true);
698 DCHECK(!connected_); 696 DCHECK(!connected_);
699 } 697 }
700 698
701 if (received_packet_manager_.HasMissingPackets()) { 699 // If there are new missing packets to report, send an ack immediately.
700 if (received_packet_manager_.HasNewMissingPackets()) {
702 send_ack_immediately = true; 701 send_ack_immediately = true;
703 } 702 }
704 703
705 MaybeSendInResponseToPacket(send_ack_immediately, 704 MaybeSendInResponseToPacket(send_ack_immediately,
706 last_packet_should_instigate_ack); 705 last_packet_should_instigate_ack);
707 706
708 ClearLastFrames(); 707 ClearLastFrames();
709 } 708 }
710 709
711 void QuicConnection::ClearLastFrames() { 710 void QuicConnection::ClearLastFrames() {
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 // If we changed the generator's batch state, restore original batch state. 1688 // If we changed the generator's batch state, restore original batch state.
1690 if (!already_in_batch_mode_) { 1689 if (!already_in_batch_mode_) {
1691 DVLOG(1) << "Leaving Batch Mode."; 1690 DVLOG(1) << "Leaving Batch Mode.";
1692 connection_->packet_generator_.FinishBatchOperations(); 1691 connection_->packet_generator_.FinishBatchOperations();
1693 } 1692 }
1694 DCHECK_EQ(already_in_batch_mode_, 1693 DCHECK_EQ(already_in_batch_mode_,
1695 connection_->packet_generator_.InBatchMode()); 1694 connection_->packet_generator_.InBatchMode());
1696 } 1695 }
1697 1696
1698 } // namespace net 1697 } // namespace net
OLDNEW
« 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