| OLD | NEW |
| 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 DCHECK(connected_); | 774 DCHECK(connected_); |
| 775 if (debug_visitor_ != nullptr) { | 775 if (debug_visitor_ != nullptr) { |
| 776 debug_visitor_->OnPingFrame(frame); | 776 debug_visitor_->OnPingFrame(frame); |
| 777 } | 777 } |
| 778 should_last_packet_instigate_acks_ = true; | 778 should_last_packet_instigate_acks_ = true; |
| 779 return true; | 779 return true; |
| 780 } | 780 } |
| 781 | 781 |
| 782 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { | 782 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { |
| 783 if (incoming_ack.largest_observed > packet_generator_.packet_number()) { | 783 if (incoming_ack.largest_observed > packet_generator_.packet_number()) { |
| 784 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:" | 784 LOG(WARNING) << ENDPOINT << "Peer's observed unsent packet:" |
| 785 << incoming_ack.largest_observed << " vs " | 785 << incoming_ack.largest_observed << " vs " |
| 786 << packet_generator_.packet_number(); | 786 << packet_generator_.packet_number(); |
| 787 // We got an error for data we have not sent. Error out. | 787 // We got an error for data we have not sent. Error out. |
| 788 return false; | 788 return false; |
| 789 } | 789 } |
| 790 | 790 |
| 791 if (incoming_ack.largest_observed < sent_packet_manager_.largest_observed()) { | 791 if (incoming_ack.largest_observed < sent_packet_manager_.largest_observed()) { |
| 792 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:" | 792 LOG(WARNING) << ENDPOINT << "Peer's largest_observed packet decreased:" |
| 793 << incoming_ack.largest_observed << " vs " | 793 << incoming_ack.largest_observed << " vs " |
| 794 << sent_packet_manager_.largest_observed(); | 794 << sent_packet_manager_.largest_observed(); |
| 795 // A new ack has a diminished largest_observed value. Error out. | 795 // A new ack has a diminished largest_observed value. Error out. |
| 796 // If this was an old packet, we wouldn't even have checked. | 796 // If this was an old packet, we wouldn't even have checked. |
| 797 return false; | 797 return false; |
| 798 } | 798 } |
| 799 | 799 |
| 800 if (!incoming_ack.missing_packets.Empty() && | 800 if (!incoming_ack.missing_packets.Empty() && |
| 801 incoming_ack.missing_packets.Max() > incoming_ack.largest_observed) { | 801 incoming_ack.missing_packets.Max() > incoming_ack.largest_observed) { |
| 802 DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: " | 802 LOG(WARNING) << ENDPOINT << "Peer sent missing packet: " |
| 803 << incoming_ack.missing_packets.Max() | 803 << incoming_ack.missing_packets.Max() |
| 804 << " which is greater than largest observed: " | 804 << " which is greater than largest observed: " |
| 805 << incoming_ack.largest_observed; | 805 << incoming_ack.largest_observed; |
| 806 return false; | 806 return false; |
| 807 } | 807 } |
| 808 | 808 |
| 809 if (!incoming_ack.missing_packets.Empty() && | 809 if (!incoming_ack.missing_packets.Empty() && |
| 810 incoming_ack.missing_packets.Min() < | 810 incoming_ack.missing_packets.Min() < |
| 811 sent_packet_manager_.least_packet_awaited_by_peer()) { | 811 sent_packet_manager_.least_packet_awaited_by_peer()) { |
| 812 DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: " | 812 LOG(WARNING) << ENDPOINT << "Peer sent missing packet: " |
| 813 << incoming_ack.missing_packets.Min() | 813 << incoming_ack.missing_packets.Min() |
| 814 << " which is smaller than least_packet_awaited_by_peer_: " | 814 << " which is smaller than least_packet_awaited_by_peer_: " |
| 815 << sent_packet_manager_.least_packet_awaited_by_peer(); | 815 << sent_packet_manager_.least_packet_awaited_by_peer(); |
| 816 return false; | 816 return false; |
| 817 } | 817 } |
| 818 | 818 |
| 819 if (!sent_entropy_manager_.IsValidEntropy( | 819 if (!sent_entropy_manager_.IsValidEntropy(incoming_ack.largest_observed, |
| 820 incoming_ack.largest_observed, | 820 incoming_ack.missing_packets, |
| 821 incoming_ack.missing_packets, | 821 incoming_ack.entropy_hash)) { |
| 822 incoming_ack.entropy_hash)) { | 822 LOG(WARNING) << ENDPOINT << "Peer sent invalid entropy."; |
| 823 DLOG(ERROR) << ENDPOINT << "Peer sent invalid entropy."; | |
| 824 return false; | 823 return false; |
| 825 } | 824 } |
| 826 | 825 |
| 827 if (incoming_ack.latest_revived_packet != 0 && | 826 if (incoming_ack.latest_revived_packet != 0 && |
| 828 !incoming_ack.missing_packets.Contains( | 827 !incoming_ack.missing_packets.Contains( |
| 829 incoming_ack.latest_revived_packet)) { | 828 incoming_ack.latest_revived_packet)) { |
| 830 DLOG(ERROR) << ENDPOINT | 829 LOG(WARNING) << ENDPOINT |
| 831 << "Peer specified revived packet which was not missing."; | 830 << "Peer specified revived packet which was not missing."; |
| 832 return false; | 831 return false; |
| 833 } | 832 } |
| 834 return true; | 833 return true; |
| 835 } | 834 } |
| 836 | 835 |
| 837 bool QuicConnection::ValidateStopWaitingFrame( | 836 bool QuicConnection::ValidateStopWaitingFrame( |
| 838 const QuicStopWaitingFrame& stop_waiting) { | 837 const QuicStopWaitingFrame& stop_waiting) { |
| 839 if (stop_waiting.least_unacked < | 838 if (stop_waiting.least_unacked < |
| 840 received_packet_manager_.peer_least_packet_awaiting_ack()) { | 839 received_packet_manager_.peer_least_packet_awaiting_ack()) { |
| 841 DLOG(ERROR) << ENDPOINT << "Peer's sent low least_unacked: " | 840 DLOG(ERROR) << ENDPOINT << "Peer's sent low least_unacked: " |
| (...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 | 2399 |
| 2401 bool QuicConnection::ack_frame_updated() const { | 2400 bool QuicConnection::ack_frame_updated() const { |
| 2402 return received_packet_manager_.ack_frame_updated(); | 2401 return received_packet_manager_.ack_frame_updated(); |
| 2403 } | 2402 } |
| 2404 | 2403 |
| 2405 void QuicConnection::set_ack_frame_updated(bool updated) { | 2404 void QuicConnection::set_ack_frame_updated(bool updated) { |
| 2406 received_packet_manager_.set_ack_frame_updated(updated); | 2405 received_packet_manager_.set_ack_frame_updated(updated); |
| 2407 } | 2406 } |
| 2408 | 2407 |
| 2409 } // namespace net | 2408 } // namespace net |
| OLD | NEW |