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

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

Issue 413403008: Remove QUIC_VERSION_15 now that Chrome Stable supports QUIC_VERSION_16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0723
Patch Set: Created 6 years, 4 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_config.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 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 544 }
545 545
546 last_ack_frames_.push_back(incoming_ack); 546 last_ack_frames_.push_back(incoming_ack);
547 return connected_; 547 return connected_;
548 } 548 }
549 549
550 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) { 550 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) {
551 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number; 551 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number;
552 received_packet_manager_.UpdatePacketInformationReceivedByPeer( 552 received_packet_manager_.UpdatePacketInformationReceivedByPeer(
553 incoming_ack.received_info); 553 incoming_ack.received_info);
554 if (version() <= QUIC_VERSION_15) {
555 ProcessStopWaitingFrame(incoming_ack.sent_info);
556 }
557 554
558 sent_entropy_manager_.ClearEntropyBefore( 555 sent_entropy_manager_.ClearEntropyBefore(
559 received_packet_manager_.least_packet_awaited_by_peer() - 1); 556 received_packet_manager_.least_packet_awaited_by_peer() - 1);
560 557
561 sent_packet_manager_.OnIncomingAck(incoming_ack.received_info, 558 sent_packet_manager_.OnIncomingAck(incoming_ack.received_info,
562 time_of_last_received_packet_); 559 time_of_last_received_packet_);
563 if (sent_packet_manager_.HasPendingRetransmissions()) { 560 if (sent_packet_manager_.HasPendingRetransmissions()) {
564 WriteIfNotBlocked(); 561 WriteIfNotBlocked();
565 } 562 }
566 563
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 if (incoming_ack.received_info.largest_observed < 632 if (incoming_ack.received_info.largest_observed <
636 received_packet_manager_.peer_largest_observed_packet()) { 633 received_packet_manager_.peer_largest_observed_packet()) {
637 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:" 634 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:"
638 << incoming_ack.received_info.largest_observed << " vs " 635 << incoming_ack.received_info.largest_observed << " vs "
639 << received_packet_manager_.peer_largest_observed_packet(); 636 << received_packet_manager_.peer_largest_observed_packet();
640 // A new ack has a diminished largest_observed value. Error out. 637 // A new ack has a diminished largest_observed value. Error out.
641 // If this was an old packet, we wouldn't even have checked. 638 // If this was an old packet, we wouldn't even have checked.
642 return false; 639 return false;
643 } 640 }
644 641
645 if (version() <= QUIC_VERSION_15) {
646 if (!ValidateStopWaitingFrame(incoming_ack.sent_info)) {
647 return false;
648 }
649 }
650
651 if (!incoming_ack.received_info.missing_packets.empty() && 642 if (!incoming_ack.received_info.missing_packets.empty() &&
652 *incoming_ack.received_info.missing_packets.rbegin() > 643 *incoming_ack.received_info.missing_packets.rbegin() >
653 incoming_ack.received_info.largest_observed) { 644 incoming_ack.received_info.largest_observed) {
654 DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: " 645 DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: "
655 << *incoming_ack.received_info.missing_packets.rbegin() 646 << *incoming_ack.received_info.missing_packets.rbegin()
656 << " which is greater than largest observed: " 647 << " which is greater than largest observed: "
657 << incoming_ack.received_info.largest_observed; 648 << incoming_ack.received_info.largest_observed;
658 return false; 649 return false;
659 } 650 }
660 651
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 last_rst_frames_.clear(); 889 last_rst_frames_.clear();
899 last_ack_frames_.clear(); 890 last_ack_frames_.clear();
900 last_stop_waiting_frames_.clear(); 891 last_stop_waiting_frames_.clear();
901 last_congestion_frames_.clear(); 892 last_congestion_frames_.clear();
902 } 893 }
903 894
904 QuicAckFrame* QuicConnection::CreateAckFrame() { 895 QuicAckFrame* QuicConnection::CreateAckFrame() {
905 QuicAckFrame* outgoing_ack = new QuicAckFrame(); 896 QuicAckFrame* outgoing_ack = new QuicAckFrame();
906 received_packet_manager_.UpdateReceivedPacketInfo( 897 received_packet_manager_.UpdateReceivedPacketInfo(
907 &(outgoing_ack->received_info), clock_->ApproximateNow()); 898 &(outgoing_ack->received_info), clock_->ApproximateNow());
908 UpdateStopWaiting(&(outgoing_ack->sent_info));
909 DVLOG(1) << ENDPOINT << "Creating ack frame: " << *outgoing_ack; 899 DVLOG(1) << ENDPOINT << "Creating ack frame: " << *outgoing_ack;
910 return outgoing_ack; 900 return outgoing_ack;
911 } 901 }
912 902
913 QuicCongestionFeedbackFrame* QuicConnection::CreateFeedbackFrame() { 903 QuicCongestionFeedbackFrame* QuicConnection::CreateFeedbackFrame() {
914 return new QuicCongestionFeedbackFrame(outgoing_congestion_feedback_); 904 return new QuicCongestionFeedbackFrame(outgoing_congestion_feedback_);
915 } 905 }
916 906
917 QuicStopWaitingFrame* QuicConnection::CreateStopWaitingFrame() { 907 QuicStopWaitingFrame* QuicConnection::CreateStopWaitingFrame() {
918 QuicStopWaitingFrame stop_waiting; 908 QuicStopWaitingFrame stop_waiting;
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) { 1566 void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) {
1577 stop_waiting->least_unacked = GetLeastUnacked(); 1567 stop_waiting->least_unacked = GetLeastUnacked();
1578 stop_waiting->entropy_hash = sent_entropy_manager_.EntropyHash( 1568 stop_waiting->entropy_hash = sent_entropy_manager_.EntropyHash(
1579 stop_waiting->least_unacked - 1); 1569 stop_waiting->least_unacked - 1);
1580 } 1570 }
1581 1571
1582 void QuicConnection::SendPing() { 1572 void QuicConnection::SendPing() {
1583 if (retransmission_alarm_->IsSet()) { 1573 if (retransmission_alarm_->IsSet()) {
1584 return; 1574 return;
1585 } 1575 }
1586 if (version() <= QUIC_VERSION_16) { 1576 if (version() == QUIC_VERSION_16) {
1587 // TODO(rch): remove this when we remove version 15 and 16. 1577 // TODO(rch): remove this when we remove version 15 and 16.
1588 // This is a horrible hideous hack which we should not support. 1578 // This is a horrible hideous hack which we should not support.
1589 IOVector data; 1579 IOVector data;
1590 char c_data[] = "C"; 1580 char c_data[] = "C";
1591 data.Append(c_data, 1); 1581 data.Append(c_data, 1);
1592 QuicConsumedData consumed_data = 1582 QuicConsumedData consumed_data =
1593 packet_generator_.ConsumeData(kCryptoStreamId, data, 0, false, 1583 packet_generator_.ConsumeData(kCryptoStreamId, data, 0, false,
1594 MAY_FEC_PROTECT, NULL); 1584 MAY_FEC_PROTECT, NULL);
1595 if (consumed_data.bytes_consumed == 0) { 1585 if (consumed_data.bytes_consumed == 0) {
1596 DLOG(ERROR) << "Unable to send ping!?"; 1586 DLOG(ERROR) << "Unable to send ping!?";
(...skipping 10 matching lines...) Expand all
1607 // method is invoked. This requires changes SetShouldSendAck 1597 // method is invoked. This requires changes SetShouldSendAck
1608 // to be a no-arg method, and re-jiggering its implementation. 1598 // to be a no-arg method, and re-jiggering its implementation.
1609 bool send_feedback = false; 1599 bool send_feedback = false;
1610 if (received_packet_manager_.GenerateCongestionFeedback( 1600 if (received_packet_manager_.GenerateCongestionFeedback(
1611 &outgoing_congestion_feedback_)) { 1601 &outgoing_congestion_feedback_)) {
1612 DVLOG(1) << ENDPOINT << "Sending feedback: " 1602 DVLOG(1) << ENDPOINT << "Sending feedback: "
1613 << outgoing_congestion_feedback_; 1603 << outgoing_congestion_feedback_;
1614 send_feedback = true; 1604 send_feedback = true;
1615 } 1605 }
1616 1606
1617 packet_generator_.SetShouldSendAck(send_feedback, 1607 packet_generator_.SetShouldSendAck(send_feedback, true);
1618 version() > QUIC_VERSION_15);
1619 } 1608 }
1620 1609
1621 void QuicConnection::OnRetransmissionTimeout() { 1610 void QuicConnection::OnRetransmissionTimeout() {
1622 if (!sent_packet_manager_.HasUnackedPackets()) { 1611 if (!sent_packet_manager_.HasUnackedPackets()) {
1623 return; 1612 return;
1624 } 1613 }
1625 1614
1626 sent_packet_manager_.OnRetransmissionTimeout(); 1615 sent_packet_manager_.OnRetransmissionTimeout();
1627 WriteIfNotBlocked(); 1616 WriteIfNotBlocked();
1628 // In the TLP case, the SentPacketManager gives the connection the opportunity 1617 // In the TLP case, the SentPacketManager gives the connection the opportunity
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 // If we changed the generator's batch state, restore original batch state. 1976 // If we changed the generator's batch state, restore original batch state.
1988 if (!already_in_batch_mode_) { 1977 if (!already_in_batch_mode_) {
1989 DVLOG(1) << "Leaving Batch Mode."; 1978 DVLOG(1) << "Leaving Batch Mode.";
1990 connection_->packet_generator_.FinishBatchOperations(); 1979 connection_->packet_generator_.FinishBatchOperations();
1991 } 1980 }
1992 DCHECK_EQ(already_in_batch_mode_, 1981 DCHECK_EQ(already_in_batch_mode_,
1993 connection_->packet_generator_.InBatchMode()); 1982 connection_->packet_generator_.InBatchMode());
1994 } 1983 }
1995 1984
1996 } // namespace net 1985 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698