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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 first_required_forward_secure_packet_(0), | 266 first_required_forward_secure_packet_(0), |
| 267 clock_(helper->GetClock()), | 267 clock_(helper->GetClock()), |
| 268 random_generator_(helper->GetRandomGenerator()), | 268 random_generator_(helper->GetRandomGenerator()), |
| 269 connection_id_(connection_id), | 269 connection_id_(connection_id), |
| 270 peer_address_(address), | 270 peer_address_(address), |
| 271 migrating_peer_port_(0), | 271 migrating_peer_port_(0), |
| 272 last_packet_decrypted_(false), | 272 last_packet_decrypted_(false), |
| 273 last_packet_revived_(false), | 273 last_packet_revived_(false), |
| 274 last_size_(0), | 274 last_size_(0), |
| 275 last_decrypted_packet_level_(ENCRYPTION_NONE), | 275 last_decrypted_packet_level_(ENCRYPTION_NONE), |
| 276 should_last_packet_instigate_acks_(false), | |
| 276 largest_seen_packet_with_ack_(0), | 277 largest_seen_packet_with_ack_(0), |
| 277 largest_seen_packet_with_stop_waiting_(0), | 278 largest_seen_packet_with_stop_waiting_(0), |
| 278 max_undecryptable_packets_(0), | 279 max_undecryptable_packets_(0), |
| 279 pending_version_negotiation_packet_(false), | 280 pending_version_negotiation_packet_(false), |
| 280 silent_close_enabled_(false), | 281 silent_close_enabled_(false), |
| 281 received_packet_manager_(&stats_), | 282 received_packet_manager_(&stats_), |
| 282 ack_queued_(false), | 283 ack_queued_(false), |
| 283 num_packets_received_since_last_ack_sent_(0), | 284 num_packets_received_since_last_ack_sent_(0), |
| 284 stop_waiting_count_(0), | 285 stop_waiting_count_(0), |
| 285 delay_setting_retransmission_alarm_(false), | 286 delay_setting_retransmission_alarm_(false), |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 if (debug_visitor_ != nullptr) { | 696 if (debug_visitor_ != nullptr) { |
| 696 debug_visitor_->OnStreamFrame(frame); | 697 debug_visitor_->OnStreamFrame(frame); |
| 697 } | 698 } |
| 698 if (frame.stream_id != kCryptoStreamId && | 699 if (frame.stream_id != kCryptoStreamId && |
| 699 last_decrypted_packet_level_ == ENCRYPTION_NONE) { | 700 last_decrypted_packet_level_ == ENCRYPTION_NONE) { |
| 700 DLOG(WARNING) << ENDPOINT | 701 DLOG(WARNING) << ENDPOINT |
| 701 << "Received an unencrypted data frame: closing connection"; | 702 << "Received an unencrypted data frame: closing connection"; |
| 702 SendConnectionClose(QUIC_UNENCRYPTED_STREAM_DATA); | 703 SendConnectionClose(QUIC_UNENCRYPTED_STREAM_DATA); |
| 703 return false; | 704 return false; |
| 704 } | 705 } |
| 705 last_stream_frames_.push_back(frame); | 706 if (FLAGS_quic_process_frames_inline) { |
| 706 return true; | 707 visitor_->OnStreamFrame(frame); |
| 708 stats_.stream_bytes_received += frame.data.size(); | |
| 709 should_last_packet_instigate_acks_ = true; | |
| 710 } else { | |
| 711 last_stream_frames_.push_back(frame); | |
| 712 } | |
| 713 return connected_; | |
| 707 } | 714 } |
| 708 | 715 |
| 709 bool QuicConnection::OnAckFrame(const QuicAckFrame& incoming_ack) { | 716 bool QuicConnection::OnAckFrame(const QuicAckFrame& incoming_ack) { |
| 710 DCHECK(connected_); | 717 DCHECK(connected_); |
| 711 if (debug_visitor_ != nullptr) { | 718 if (debug_visitor_ != nullptr) { |
| 712 debug_visitor_->OnAckFrame(incoming_ack); | 719 debug_visitor_->OnAckFrame(incoming_ack); |
| 713 } | 720 } |
| 714 DVLOG(1) << ENDPOINT << "OnAckFrame: " << incoming_ack; | 721 DVLOG(1) << ENDPOINT << "OnAckFrame: " << incoming_ack; |
| 715 | 722 |
| 716 if (last_header_.packet_sequence_number <= largest_seen_packet_with_ack_) { | 723 if (last_header_.packet_sequence_number <= largest_seen_packet_with_ack_) { |
| 717 DVLOG(1) << ENDPOINT << "Received an old ack frame: ignoring"; | 724 DVLOG(1) << ENDPOINT << "Received an old ack frame: ignoring"; |
| 718 return true; | 725 return true; |
| 719 } | 726 } |
| 720 | 727 |
| 721 if (!ValidateAckFrame(incoming_ack)) { | 728 if (!ValidateAckFrame(incoming_ack)) { |
| 722 SendConnectionClose(QUIC_INVALID_ACK_DATA); | 729 SendConnectionClose(QUIC_INVALID_ACK_DATA); |
| 723 return false; | 730 return false; |
| 724 } | 731 } |
| 725 | 732 |
| 726 last_ack_frames_.push_back(incoming_ack); | 733 if (FLAGS_quic_process_frames_inline) { |
| 734 ProcessAckFrame(incoming_ack); | |
| 735 if (incoming_ack.is_truncated) { | |
| 736 should_last_packet_instigate_acks_ = true; | |
| 737 } | |
| 738 QuicPacketSequenceNumber least_acked = GetLeastUnacked(); | |
|
ramant (doing other things)
2015/07/17 23:08:31
Hi Ryan and Ian,
linux's safe iterator doesn't a
Ryan Hamilton
2015/07/17 23:21:33
Good point!
| |
| 739 if (least_acked > 0 && | |
| 740 (incoming_ack.missing_packets.empty() || | |
| 741 least_acked > *incoming_ack.missing_packets.begin())) { | |
| 742 ++stop_waiting_count_; | |
| 743 } else { | |
| 744 stop_waiting_count_ = 0; | |
| 745 } | |
| 746 } else { | |
| 747 last_ack_frames_.push_back(incoming_ack); | |
| 748 } | |
| 727 return connected_; | 749 return connected_; |
| 728 } | 750 } |
| 729 | 751 |
| 730 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) { | 752 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) { |
| 731 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number; | 753 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number; |
| 732 sent_packet_manager_.OnIncomingAck(incoming_ack, | 754 sent_packet_manager_.OnIncomingAck(incoming_ack, |
| 733 time_of_last_received_packet_); | 755 time_of_last_received_packet_); |
| 734 sent_entropy_manager_.ClearEntropyBefore( | 756 sent_entropy_manager_.ClearEntropyBefore( |
| 735 sent_packet_manager_.least_packet_awaited_by_peer() - 1); | 757 sent_packet_manager_.least_packet_awaited_by_peer() - 1); |
| 736 | 758 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 767 | 789 |
| 768 last_stop_waiting_frames_.push_back(frame); | 790 last_stop_waiting_frames_.push_back(frame); |
| 769 return connected_; | 791 return connected_; |
| 770 } | 792 } |
| 771 | 793 |
| 772 bool QuicConnection::OnPingFrame(const QuicPingFrame& frame) { | 794 bool QuicConnection::OnPingFrame(const QuicPingFrame& frame) { |
| 773 DCHECK(connected_); | 795 DCHECK(connected_); |
| 774 if (debug_visitor_ != nullptr) { | 796 if (debug_visitor_ != nullptr) { |
| 775 debug_visitor_->OnPingFrame(frame); | 797 debug_visitor_->OnPingFrame(frame); |
| 776 } | 798 } |
| 777 last_ping_frames_.push_back(frame); | 799 if (FLAGS_quic_process_frames_inline) { |
| 800 should_last_packet_instigate_acks_ = true; | |
| 801 } else { | |
| 802 last_ping_frames_.push_back(frame); | |
| 803 } | |
| 778 return true; | 804 return true; |
| 779 } | 805 } |
| 780 | 806 |
| 781 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { | 807 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { |
| 782 if (incoming_ack.largest_observed > packet_generator_.sequence_number()) { | 808 if (incoming_ack.largest_observed > packet_generator_.sequence_number()) { |
| 783 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:" | 809 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:" |
| 784 << incoming_ack.largest_observed << " vs " | 810 << incoming_ack.largest_observed << " vs " |
| 785 << packet_generator_.sequence_number(); | 811 << packet_generator_.sequence_number(); |
| 786 // We got an error for data we have not sent. Error out. | 812 // We got an error for data we have not sent. Error out. |
| 787 return false; | 813 return false; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 } | 892 } |
| 867 } | 893 } |
| 868 | 894 |
| 869 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 895 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
| 870 DCHECK(connected_); | 896 DCHECK(connected_); |
| 871 if (debug_visitor_ != nullptr) { | 897 if (debug_visitor_ != nullptr) { |
| 872 debug_visitor_->OnRstStreamFrame(frame); | 898 debug_visitor_->OnRstStreamFrame(frame); |
| 873 } | 899 } |
| 874 DVLOG(1) << ENDPOINT << "Stream reset with error " | 900 DVLOG(1) << ENDPOINT << "Stream reset with error " |
| 875 << QuicUtils::StreamErrorToString(frame.error_code); | 901 << QuicUtils::StreamErrorToString(frame.error_code); |
| 876 last_rst_frames_.push_back(frame); | 902 if (FLAGS_quic_process_frames_inline) { |
| 903 visitor_->OnRstStream(frame); | |
| 904 should_last_packet_instigate_acks_ = true; | |
| 905 } else { | |
| 906 last_rst_frames_.push_back(frame); | |
| 907 } | |
| 877 return connected_; | 908 return connected_; |
| 878 } | 909 } |
| 879 | 910 |
| 880 bool QuicConnection::OnConnectionCloseFrame( | 911 bool QuicConnection::OnConnectionCloseFrame( |
| 881 const QuicConnectionCloseFrame& frame) { | 912 const QuicConnectionCloseFrame& frame) { |
| 882 DCHECK(connected_); | 913 DCHECK(connected_); |
| 883 if (debug_visitor_ != nullptr) { | 914 if (debug_visitor_ != nullptr) { |
| 884 debug_visitor_->OnConnectionCloseFrame(frame); | 915 debug_visitor_->OnConnectionCloseFrame(frame); |
| 885 } | 916 } |
| 886 DVLOG(1) << ENDPOINT << "Connection " << connection_id() | 917 DVLOG(1) << ENDPOINT << "Connection " << connection_id() |
| 887 << " closed with error " | 918 << " closed with error " |
| 888 << QuicUtils::ErrorToString(frame.error_code) | 919 << QuicUtils::ErrorToString(frame.error_code) |
| 889 << " " << frame.error_details; | 920 << " " << frame.error_details; |
| 890 last_close_frames_.push_back(frame); | 921 if (FLAGS_quic_process_frames_inline) { |
| 922 CloseConnection(frame.error_code, true); | |
| 923 } else { | |
| 924 last_close_frames_.push_back(frame); | |
| 925 } | |
| 891 return connected_; | 926 return connected_; |
| 892 } | 927 } |
| 893 | 928 |
| 894 bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { | 929 bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { |
| 895 DCHECK(connected_); | 930 DCHECK(connected_); |
| 896 if (debug_visitor_ != nullptr) { | 931 if (debug_visitor_ != nullptr) { |
| 897 debug_visitor_->OnGoAwayFrame(frame); | 932 debug_visitor_->OnGoAwayFrame(frame); |
| 898 } | 933 } |
| 899 DVLOG(1) << ENDPOINT << "Go away received with error " | 934 DVLOG(1) << ENDPOINT << "Go away received with error " |
| 900 << QuicUtils::ErrorToString(frame.error_code) | 935 << QuicUtils::ErrorToString(frame.error_code) |
| 901 << " and reason:" << frame.reason_phrase; | 936 << " and reason:" << frame.reason_phrase; |
| 902 last_goaway_frames_.push_back(frame); | 937 if (FLAGS_quic_process_frames_inline) { |
| 938 visitor_->OnGoAway(frame); | |
| 939 should_last_packet_instigate_acks_ = true; | |
| 940 } else { | |
| 941 last_goaway_frames_.push_back(frame); | |
| 942 } | |
| 903 return connected_; | 943 return connected_; |
| 904 } | 944 } |
| 905 | 945 |
| 906 bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { | 946 bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { |
| 907 DCHECK(connected_); | 947 DCHECK(connected_); |
| 908 if (debug_visitor_ != nullptr) { | 948 if (debug_visitor_ != nullptr) { |
| 909 debug_visitor_->OnWindowUpdateFrame(frame); | 949 debug_visitor_->OnWindowUpdateFrame(frame); |
| 910 } | 950 } |
| 911 DVLOG(1) << ENDPOINT << "WindowUpdate received for stream: " | 951 DVLOG(1) << ENDPOINT << "WindowUpdate received for stream: " |
| 912 << frame.stream_id << " with byte offset: " << frame.byte_offset; | 952 << frame.stream_id << " with byte offset: " << frame.byte_offset; |
| 913 last_window_update_frames_.push_back(frame); | 953 if (FLAGS_quic_process_frames_inline) { |
| 954 visitor_->OnWindowUpdateFrame(frame); | |
| 955 should_last_packet_instigate_acks_ = true; | |
| 956 } else { | |
| 957 last_window_update_frames_.push_back(frame); | |
| 958 } | |
| 914 return connected_; | 959 return connected_; |
| 915 } | 960 } |
| 916 | 961 |
| 917 bool QuicConnection::OnBlockedFrame(const QuicBlockedFrame& frame) { | 962 bool QuicConnection::OnBlockedFrame(const QuicBlockedFrame& frame) { |
| 918 DCHECK(connected_); | 963 DCHECK(connected_); |
| 919 if (debug_visitor_ != nullptr) { | 964 if (debug_visitor_ != nullptr) { |
| 920 debug_visitor_->OnBlockedFrame(frame); | 965 debug_visitor_->OnBlockedFrame(frame); |
| 921 } | 966 } |
| 922 DVLOG(1) << ENDPOINT << "Blocked frame received for stream: " | 967 DVLOG(1) << ENDPOINT << "Blocked frame received for stream: " |
| 923 << frame.stream_id; | 968 << frame.stream_id; |
| 924 last_blocked_frames_.push_back(frame); | 969 if (FLAGS_quic_process_frames_inline) { |
| 970 visitor_->OnBlockedFrame(frame); | |
| 971 should_last_packet_instigate_acks_ = true; | |
| 972 } else { | |
| 973 last_blocked_frames_.push_back(frame); | |
| 974 } | |
| 925 return connected_; | 975 return connected_; |
| 926 } | 976 } |
| 927 | 977 |
| 928 void QuicConnection::OnPacketComplete() { | 978 void QuicConnection::OnPacketComplete() { |
| 929 // Don't do anything if this packet closed the connection. | 979 // Don't do anything if this packet closed the connection. |
| 930 if (!connected_) { | 980 if (!connected_) { |
| 931 ClearLastFrames(); | 981 ClearLastFrames(); |
| 932 return; | 982 return; |
| 933 } | 983 } |
| 934 | 984 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 955 // processing stream frames, since the processing may result in a response | 1005 // processing stream frames, since the processing may result in a response |
| 956 // packet with a bundled ack. | 1006 // packet with a bundled ack. |
| 957 if (last_packet_revived_) { | 1007 if (last_packet_revived_) { |
| 958 received_packet_manager_.RecordPacketRevived( | 1008 received_packet_manager_.RecordPacketRevived( |
| 959 last_header_.packet_sequence_number); | 1009 last_header_.packet_sequence_number); |
| 960 } else { | 1010 } else { |
| 961 received_packet_manager_.RecordPacketReceived( | 1011 received_packet_manager_.RecordPacketReceived( |
| 962 last_size_, last_header_, time_of_last_received_packet_); | 1012 last_size_, last_header_, time_of_last_received_packet_); |
| 963 } | 1013 } |
| 964 | 1014 |
| 965 for (const QuicStreamFrame& frame : last_stream_frames_) { | 1015 if (!FLAGS_quic_process_frames_inline) { |
| 966 visitor_->OnStreamFrame(frame); | 1016 for (const QuicStreamFrame& frame : last_stream_frames_) { |
| 967 stats_.stream_bytes_received += frame.data.size(); | 1017 visitor_->OnStreamFrame(frame); |
| 968 if (!connected_) { | 1018 stats_.stream_bytes_received += frame.data.size(); |
| 1019 if (!connected_) { | |
| 1020 return; | |
| 1021 } | |
| 1022 } | |
| 1023 | |
| 1024 // Process window updates, blocked, stream resets, acks, then stop waiting. | |
| 1025 for (const QuicWindowUpdateFrame& frame : last_window_update_frames_) { | |
| 1026 visitor_->OnWindowUpdateFrame(frame); | |
| 1027 if (!connected_) { | |
| 1028 return; | |
| 1029 } | |
| 1030 } | |
| 1031 for (const QuicBlockedFrame& frame : last_blocked_frames_) { | |
| 1032 visitor_->OnBlockedFrame(frame); | |
| 1033 if (!connected_) { | |
| 1034 return; | |
| 1035 } | |
| 1036 } | |
| 1037 for (const QuicGoAwayFrame& frame : last_goaway_frames_) { | |
| 1038 visitor_->OnGoAway(frame); | |
| 1039 if (!connected_) { | |
| 1040 return; | |
| 1041 } | |
| 1042 } | |
| 1043 for (const QuicRstStreamFrame& frame : last_rst_frames_) { | |
| 1044 visitor_->OnRstStream(frame); | |
| 1045 if (!connected_) { | |
| 1046 return; | |
| 1047 } | |
| 1048 } | |
| 1049 for (const QuicAckFrame& frame : last_ack_frames_) { | |
| 1050 ProcessAckFrame(frame); | |
| 1051 if (!connected_) { | |
| 1052 return; | |
| 1053 } | |
| 1054 } | |
| 1055 if (!last_close_frames_.empty()) { | |
| 1056 CloseConnection(last_close_frames_[0].error_code, true); | |
| 1057 DCHECK(!connected_); | |
| 969 return; | 1058 return; |
| 970 } | 1059 } |
| 971 } | 1060 } |
| 972 | 1061 // Continue to process stop waiting frames later, because the packet needs |
| 973 // Process window updates, blocked, stream resets, acks, then congestion | 1062 // to be considered 'received' before the entropy can be updated. |
| 974 // feedback. | |
| 975 for (const QuicWindowUpdateFrame& frame : last_window_update_frames_) { | |
| 976 visitor_->OnWindowUpdateFrame(frame); | |
| 977 if (!connected_) { | |
| 978 return; | |
| 979 } | |
| 980 } | |
| 981 for (const QuicBlockedFrame& frame : last_blocked_frames_) { | |
| 982 visitor_->OnBlockedFrame(frame); | |
| 983 if (!connected_) { | |
| 984 return; | |
| 985 } | |
| 986 } | |
| 987 for (const QuicGoAwayFrame& frame : last_goaway_frames_) { | |
| 988 visitor_->OnGoAway(frame); | |
| 989 if (!connected_) { | |
| 990 return; | |
| 991 } | |
| 992 } | |
| 993 for (const QuicRstStreamFrame& frame : last_rst_frames_) { | |
| 994 visitor_->OnRstStream(frame); | |
| 995 if (!connected_) { | |
| 996 return; | |
| 997 } | |
| 998 } | |
| 999 for (const QuicAckFrame& frame : last_ack_frames_) { | |
| 1000 ProcessAckFrame(frame); | |
| 1001 if (!connected_) { | |
| 1002 return; | |
| 1003 } | |
| 1004 } | |
| 1005 for (const QuicStopWaitingFrame& frame : last_stop_waiting_frames_) { | 1063 for (const QuicStopWaitingFrame& frame : last_stop_waiting_frames_) { |
| 1006 ProcessStopWaitingFrame(frame); | 1064 ProcessStopWaitingFrame(frame); |
| 1007 if (!connected_) { | 1065 if (!connected_) { |
| 1008 return; | 1066 return; |
| 1009 } | 1067 } |
| 1010 } | 1068 } |
| 1011 if (!last_close_frames_.empty()) { | |
| 1012 CloseConnection(last_close_frames_[0].error_code, true); | |
| 1013 DCHECK(!connected_); | |
| 1014 return; | |
| 1015 } | |
| 1016 | 1069 |
| 1017 // If there are new missing packets to report, send an ack immediately. | 1070 // If there are new missing packets to report, send an ack immediately. |
| 1018 if (ShouldLastPacketInstigateAck() && | 1071 if (ShouldLastPacketInstigateAck() && |
| 1019 received_packet_manager_.HasNewMissingPackets()) { | 1072 received_packet_manager_.HasNewMissingPackets()) { |
| 1020 ack_queued_ = true; | 1073 ack_queued_ = true; |
| 1021 ack_alarm_->Cancel(); | 1074 ack_alarm_->Cancel(); |
| 1022 } | 1075 } |
| 1023 | 1076 |
| 1024 UpdateStopWaitingCount(); | 1077 UpdateStopWaitingCount(); |
| 1025 ClearLastFrames(); | 1078 ClearLastFrames(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1044 DVLOG(1) << "Ack timer set; next packet or timer will trigger ACK."; | 1097 DVLOG(1) << "Ack timer set; next packet or timer will trigger ACK."; |
| 1045 } | 1098 } |
| 1046 } | 1099 } |
| 1047 | 1100 |
| 1048 if (ack_queued_) { | 1101 if (ack_queued_) { |
| 1049 ack_alarm_->Cancel(); | 1102 ack_alarm_->Cancel(); |
| 1050 } | 1103 } |
| 1051 } | 1104 } |
| 1052 | 1105 |
| 1053 void QuicConnection::ClearLastFrames() { | 1106 void QuicConnection::ClearLastFrames() { |
| 1107 if (FLAGS_quic_process_frames_inline) { | |
| 1108 should_last_packet_instigate_acks_ = false; | |
| 1109 last_stop_waiting_frames_.clear(); | |
| 1110 return; | |
| 1111 } | |
| 1054 last_stream_frames_.clear(); | 1112 last_stream_frames_.clear(); |
| 1055 last_ack_frames_.clear(); | 1113 last_ack_frames_.clear(); |
| 1056 last_stop_waiting_frames_.clear(); | 1114 last_stop_waiting_frames_.clear(); |
| 1057 last_rst_frames_.clear(); | 1115 last_rst_frames_.clear(); |
| 1058 last_goaway_frames_.clear(); | 1116 last_goaway_frames_.clear(); |
| 1059 last_window_update_frames_.clear(); | 1117 last_window_update_frames_.clear(); |
| 1060 last_blocked_frames_.clear(); | 1118 last_blocked_frames_.clear(); |
| 1061 last_ping_frames_.clear(); | 1119 last_ping_frames_.clear(); |
| 1062 last_close_frames_.clear(); | 1120 last_close_frames_.clear(); |
| 1063 } | 1121 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1086 } | 1144 } |
| 1087 | 1145 |
| 1088 void QuicConnection::PopulateStopWaitingFrame( | 1146 void QuicConnection::PopulateStopWaitingFrame( |
| 1089 QuicStopWaitingFrame* stop_waiting) { | 1147 QuicStopWaitingFrame* stop_waiting) { |
| 1090 stop_waiting->least_unacked = GetLeastUnacked(); | 1148 stop_waiting->least_unacked = GetLeastUnacked(); |
| 1091 stop_waiting->entropy_hash = sent_entropy_manager_.GetCumulativeEntropy( | 1149 stop_waiting->entropy_hash = sent_entropy_manager_.GetCumulativeEntropy( |
| 1092 stop_waiting->least_unacked - 1); | 1150 stop_waiting->least_unacked - 1); |
| 1093 } | 1151 } |
| 1094 | 1152 |
| 1095 bool QuicConnection::ShouldLastPacketInstigateAck() const { | 1153 bool QuicConnection::ShouldLastPacketInstigateAck() const { |
| 1096 if (!last_stream_frames_.empty() || | 1154 if (FLAGS_quic_process_frames_inline && should_last_packet_instigate_acks_) { |
| 1097 !last_goaway_frames_.empty() || | |
| 1098 !last_rst_frames_.empty() || | |
| 1099 !last_window_update_frames_.empty() || | |
| 1100 !last_blocked_frames_.empty() || | |
| 1101 !last_ping_frames_.empty()) { | |
| 1102 return true; | 1155 return true; |
| 1103 } | 1156 } |
| 1157 if (!FLAGS_quic_process_frames_inline) { | |
| 1158 if (!last_stream_frames_.empty() || !last_goaway_frames_.empty() || | |
| 1159 !last_rst_frames_.empty() || !last_window_update_frames_.empty() || | |
| 1160 !last_blocked_frames_.empty() || !last_ping_frames_.empty()) { | |
| 1161 return true; | |
| 1162 } | |
| 1104 | 1163 |
| 1105 if (!last_ack_frames_.empty() && last_ack_frames_.back().is_truncated) { | 1164 if (!last_ack_frames_.empty() && last_ack_frames_.back().is_truncated) { |
| 1106 return true; | 1165 return true; |
| 1166 } | |
| 1107 } | 1167 } |
| 1108 // Always send an ack every 20 packets in order to allow the peer to discard | 1168 // Always send an ack every 20 packets in order to allow the peer to discard |
| 1109 // information from the SentPacketManager and provide an RTT measurement. | 1169 // information from the SentPacketManager and provide an RTT measurement. |
| 1110 if (num_packets_received_since_last_ack_sent_ >= | 1170 if (num_packets_received_since_last_ack_sent_ >= |
| 1111 kMaxPacketsReceivedBeforeAckSend) { | 1171 kMaxPacketsReceivedBeforeAckSend) { |
| 1112 return true; | 1172 return true; |
| 1113 } | 1173 } |
| 1114 return false; | 1174 return false; |
| 1115 } | 1175 } |
| 1116 | 1176 |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2318 sequence_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2378 sequence_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
| 2319 ++mtu_probe_count_; | 2379 ++mtu_probe_count_; |
| 2320 | 2380 |
| 2321 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2381 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
| 2322 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2382 SendMtuDiscoveryPacket(mtu_discovery_target_); |
| 2323 | 2383 |
| 2324 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2384 DCHECK(!mtu_discovery_alarm_->IsSet()); |
| 2325 } | 2385 } |
| 2326 | 2386 |
| 2327 } // namespace net | 2387 } // namespace net |
| OLD | NEW |