Chromium Code Reviews| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 DCHECK(connected_); | 783 DCHECK(connected_); |
| 784 if (debug_visitor_ != nullptr) { | 784 if (debug_visitor_ != nullptr) { |
| 785 debug_visitor_->OnPingFrame(frame); | 785 debug_visitor_->OnPingFrame(frame); |
| 786 } | 786 } |
| 787 should_last_packet_instigate_acks_ = true; | 787 should_last_packet_instigate_acks_ = true; |
| 788 return true; | 788 return true; |
| 789 } | 789 } |
| 790 | 790 |
| 791 const char* QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { | 791 const char* QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { |
| 792 if (incoming_ack.largest_observed > packet_generator_.packet_number()) { | 792 if (incoming_ack.largest_observed > packet_generator_.packet_number()) { |
| 793 LOG(WARNING) << ENDPOINT << "Peer's observed unsent packet:" | 793 // clang-format off |
|
Ryan Hamilton
2016/02/02 04:33:19
Why clang-format off?
ramant (doing other things)
2016/02/02 05:08:25
Added it to keep code in sync with internal code.
Ryan Hamilton
2016/02/02 05:23:26
Hm. I'm not in love with that. We could define LOG
ramant (doing other things)
2016/02/02 06:42:10
Reverted the clang-format statements.
+1 to addin
| |
| 794 << incoming_ack.largest_observed << " vs " | 794 LOG(WARNING) |
| 795 << packet_generator_.packet_number(); | 795 << ENDPOINT |
| 796 << "Peer's observed unsent packet:" << incoming_ack.largest_observed | |
| 797 << " vs " << packet_generator_.packet_number(); | |
| 798 // clang-format on | |
| 796 // We got an error for data we have not sent. Error out. | 799 // We got an error for data we have not sent. Error out. |
| 797 return "Largest observed too high"; | 800 return "Largest observed too high"; |
| 798 } | 801 } |
| 799 | 802 |
| 800 if (incoming_ack.largest_observed < sent_packet_manager_.largest_observed()) { | 803 if (incoming_ack.largest_observed < sent_packet_manager_.largest_observed()) { |
| 801 LOG(WARNING) << ENDPOINT << "Peer's largest_observed packet decreased:" | 804 LOG(WARNING) << ENDPOINT << "Peer's largest_observed packet decreased:" |
| 802 << incoming_ack.largest_observed << " vs " | 805 << incoming_ack.largest_observed << " vs " |
| 803 << sent_packet_manager_.largest_observed(); | 806 << sent_packet_manager_.largest_observed(); |
| 804 // A new ack has a diminished largest_observed value. Error out. | 807 // A new ack has a diminished largest_observed value. Error out. |
| 805 // If this was an old packet, we wouldn't even have checked. | 808 // If this was an old packet, we wouldn't even have checked. |
| 806 return "Largest observed too low"; | 809 return "Largest observed too low"; |
| 807 } | 810 } |
| 808 | 811 |
| 809 if (!incoming_ack.missing_packets.Empty() && | 812 if (!incoming_ack.missing_packets.Empty() && |
| 810 incoming_ack.missing_packets.Max() > incoming_ack.largest_observed) { | 813 incoming_ack.missing_packets.Max() > incoming_ack.largest_observed) { |
| 811 LOG(WARNING) << ENDPOINT << "Peer sent missing packet: " | 814 // clang-format off |
| 812 << incoming_ack.missing_packets.Max() | 815 LOG(WARNING) |
| 813 << " which is greater than largest observed: " | 816 << ENDPOINT |
| 814 << incoming_ack.largest_observed; | 817 << "Peer sent missing packet: " << incoming_ack.missing_packets.Max() |
| 818 << " which is greater than largest observed: " | |
| 819 << incoming_ack.largest_observed; | |
| 820 // clang-format on | |
| 815 return "Missing packet higher than largest observed"; | 821 return "Missing packet higher than largest observed"; |
| 816 } | 822 } |
| 817 | 823 |
| 818 if (!incoming_ack.missing_packets.Empty() && | 824 if (!incoming_ack.missing_packets.Empty() && |
| 819 incoming_ack.missing_packets.Min() < | 825 incoming_ack.missing_packets.Min() < |
| 820 sent_packet_manager_.least_packet_awaited_by_peer()) { | 826 sent_packet_manager_.least_packet_awaited_by_peer()) { |
| 821 LOG(WARNING) << ENDPOINT << "Peer sent missing packet: " | 827 // clang-format off |
| 822 << incoming_ack.missing_packets.Min() | 828 LOG(WARNING) |
| 823 << " which is smaller than least_packet_awaited_by_peer_: " | 829 << ENDPOINT |
| 824 << sent_packet_manager_.least_packet_awaited_by_peer(); | 830 << "Peer sent missing packet: " << incoming_ack.missing_packets.Min() |
| 831 << " which is smaller than least_packet_awaited_by_peer_: " | |
| 832 << sent_packet_manager_.least_packet_awaited_by_peer(); | |
| 833 // clang-format on | |
| 825 return "Missing packet smaller than least awaited"; | 834 return "Missing packet smaller than least awaited"; |
| 826 } | 835 } |
| 827 | 836 |
| 828 if (!sent_entropy_manager_.IsValidEntropy(incoming_ack.largest_observed, | 837 if (!sent_entropy_manager_.IsValidEntropy(incoming_ack.largest_observed, |
| 829 incoming_ack.missing_packets, | 838 incoming_ack.missing_packets, |
| 830 incoming_ack.entropy_hash)) { | 839 incoming_ack.entropy_hash)) { |
| 831 LOG(WARNING) << ENDPOINT << "Peer sent invalid entropy."; | 840 // clang-format off |
| 841 LOG(WARNING) | |
| 842 << ENDPOINT << "Peer sent invalid entropy." | |
| 843 << " largest_observed:" << incoming_ack.largest_observed | |
| 844 << " last_received:" << last_header_.packet_number; | |
| 845 // clang-format on | |
| 832 return "Invalid entropy"; | 846 return "Invalid entropy"; |
| 833 } | 847 } |
| 834 | 848 |
| 835 if (incoming_ack.latest_revived_packet != 0 && | 849 if (incoming_ack.latest_revived_packet != 0 && |
| 836 !incoming_ack.missing_packets.Contains( | 850 !incoming_ack.missing_packets.Contains( |
| 837 incoming_ack.latest_revived_packet)) { | 851 incoming_ack.latest_revived_packet)) { |
| 838 LOG(WARNING) << ENDPOINT | 852 // clang-format off |
| 839 << "Peer specified revived packet which was not missing."; | 853 LOG(WARNING) |
| 854 << ENDPOINT << "Peer specified revived packet which was not missing." | |
| 855 << " revived_packet:" << incoming_ack.latest_revived_packet; | |
| 856 // clang-format on | |
| 840 return "Invalid revived packet"; | 857 return "Invalid revived packet"; |
| 841 } | 858 } |
| 842 return nullptr; | 859 return nullptr; |
| 843 } | 860 } |
| 844 | 861 |
| 845 const char* QuicConnection::ValidateStopWaitingFrame( | 862 const char* QuicConnection::ValidateStopWaitingFrame( |
| 846 const QuicStopWaitingFrame& stop_waiting) { | 863 const QuicStopWaitingFrame& stop_waiting) { |
| 847 if (stop_waiting.least_unacked < | 864 if (stop_waiting.least_unacked < |
| 848 received_packet_manager_.peer_least_packet_awaiting_ack()) { | 865 received_packet_manager_.peer_least_packet_awaiting_ack()) { |
| 849 DLOG(ERROR) << ENDPOINT << "Peer's sent low least_unacked: " | 866 DLOG(ERROR) << ENDPOINT << "Peer's sent low least_unacked: " |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2444 void QuicConnection::OnPathClosed(QuicPathId path_id) { | 2461 void QuicConnection::OnPathClosed(QuicPathId path_id) { |
| 2445 // Stop receiving packets on this path. | 2462 // Stop receiving packets on this path. |
| 2446 framer_.OnPathClosed(path_id); | 2463 framer_.OnPathClosed(path_id); |
| 2447 } | 2464 } |
| 2448 | 2465 |
| 2449 bool QuicConnection::ack_frame_updated() const { | 2466 bool QuicConnection::ack_frame_updated() const { |
| 2450 return received_packet_manager_.ack_frame_updated(); | 2467 return received_packet_manager_.ack_frame_updated(); |
| 2451 } | 2468 } |
| 2452 | 2469 |
| 2453 } // namespace net | 2470 } // namespace net |
| OLD | NEW |