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

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

Issue 876313009: Keep an instance of QuicAckFrame in QuicConnection in order to reduce (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Fix_compile_errors_85182632
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection.h ('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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 } 962 }
963 // This occurs if there are received packet gaps and the peer does not raise 963 // This occurs if there are received packet gaps and the peer does not raise
964 // the least unacked fast enough. 964 // the least unacked fast enough.
965 if (received_packet_manager_.NumTrackedPackets() > kMaxTrackedPackets) { 965 if (received_packet_manager_.NumTrackedPackets() > kMaxTrackedPackets) {
966 SendConnectionCloseWithDetails( 966 SendConnectionCloseWithDetails(
967 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS, 967 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS,
968 StringPrintf("More than %" PRIu64 " outstanding.", kMaxTrackedPackets)); 968 StringPrintf("More than %" PRIu64 " outstanding.", kMaxTrackedPackets));
969 } 969 }
970 } 970 }
971 971
972 QuicAckFrame* QuicConnection::CreateAckFrame() { 972 void QuicConnection::PopulateAckFrame(QuicAckFrame* ack) {
973 QuicAckFrame* outgoing_ack = new QuicAckFrame(); 973 received_packet_manager_.UpdateReceivedPacketInfo(ack,
974 received_packet_manager_.UpdateReceivedPacketInfo( 974 clock_->ApproximateNow());
975 outgoing_ack, clock_->ApproximateNow());
976 DVLOG(1) << ENDPOINT << "Creating ack frame: " << *outgoing_ack;
977 return outgoing_ack;
978 } 975 }
979 976
980 QuicStopWaitingFrame* QuicConnection::CreateStopWaitingFrame() { 977 void QuicConnection::PopulateStopWaitingFrame(
981 QuicStopWaitingFrame stop_waiting; 978 QuicStopWaitingFrame* stop_waiting) {
982 UpdateStopWaiting(&stop_waiting); 979 stop_waiting->least_unacked = GetLeastUnacked();
983 return new QuicStopWaitingFrame(stop_waiting); 980 stop_waiting->entropy_hash = sent_entropy_manager_.GetCumulativeEntropy(
981 stop_waiting->least_unacked - 1);
984 } 982 }
985 983
986 bool QuicConnection::ShouldLastPacketInstigateAck() const { 984 bool QuicConnection::ShouldLastPacketInstigateAck() const {
987 if (!last_stream_frames_.empty() || 985 if (!last_stream_frames_.empty() ||
988 !last_goaway_frames_.empty() || 986 !last_goaway_frames_.empty() ||
989 !last_rst_frames_.empty() || 987 !last_rst_frames_.empty() ||
990 !last_window_update_frames_.empty() || 988 !last_window_update_frames_.empty() ||
991 !last_blocked_frames_.empty() || 989 !last_blocked_frames_.empty() ||
992 !last_ping_frames_.empty()) { 990 !last_ping_frames_.empty()) {
993 return true; 991 return true;
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 } 1643 }
1646 1644
1647 sent_entropy_manager_.RecordPacketEntropyHash( 1645 sent_entropy_manager_.RecordPacketEntropyHash(
1648 packet.serialized_packet.sequence_number, 1646 packet.serialized_packet.sequence_number,
1649 packet.serialized_packet.entropy_hash); 1647 packet.serialized_packet.entropy_hash);
1650 if (!WritePacket(&packet)) { 1648 if (!WritePacket(&packet)) {
1651 queued_packets_.push_back(packet); 1649 queued_packets_.push_back(packet);
1652 } 1650 }
1653 } 1651 }
1654 1652
1655 void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) {
1656 stop_waiting->least_unacked = GetLeastUnacked();
1657 stop_waiting->entropy_hash = sent_entropy_manager_.GetCumulativeEntropy(
1658 stop_waiting->least_unacked - 1);
1659 }
1660
1661 void QuicConnection::SendPing() { 1653 void QuicConnection::SendPing() {
1662 if (retransmission_alarm_->IsSet()) { 1654 if (retransmission_alarm_->IsSet()) {
1663 return; 1655 return;
1664 } 1656 }
1665 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame)); 1657 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame));
1666 } 1658 }
1667 1659
1668 void QuicConnection::SendAck() { 1660 void QuicConnection::SendAck() {
1669 ack_alarm_->Cancel(); 1661 ack_alarm_->Cancel();
1670 stop_waiting_count_ = 0; 1662 stop_waiting_count_ = 0;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 } 2101 }
2110 for (const QuicFrame& frame : retransmittable_frames->frames()) { 2102 for (const QuicFrame& frame : retransmittable_frames->frames()) {
2111 if (frame.type == CONNECTION_CLOSE_FRAME) { 2103 if (frame.type == CONNECTION_CLOSE_FRAME) {
2112 return true; 2104 return true;
2113 } 2105 }
2114 } 2106 }
2115 return false; 2107 return false;
2116 } 2108 }
2117 2109
2118 } // namespace net 2110 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698