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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 if (last_packet_revived_) { | 900 if (last_packet_revived_) { |
901 received_packet_manager_.RecordPacketRevived( | 901 received_packet_manager_.RecordPacketRevived( |
902 last_header_.packet_sequence_number); | 902 last_header_.packet_sequence_number); |
903 } else { | 903 } else { |
904 received_packet_manager_.RecordPacketReceived( | 904 received_packet_manager_.RecordPacketReceived( |
905 last_size_, last_header_, time_of_last_received_packet_); | 905 last_size_, last_header_, time_of_last_received_packet_); |
906 } | 906 } |
907 | 907 |
908 if (!last_stream_frames_.empty()) { | 908 if (!last_stream_frames_.empty()) { |
909 visitor_->OnStreamFrames(last_stream_frames_); | 909 visitor_->OnStreamFrames(last_stream_frames_); |
| 910 if (!connected_ && !FLAGS_quic_stop_early) { |
| 911 return; |
| 912 } |
910 } | 913 } |
911 | 914 |
912 for (size_t i = 0; i < last_stream_frames_.size(); ++i) { | 915 for (size_t i = 0; i < last_stream_frames_.size(); ++i) { |
913 stats_.stream_bytes_received += | 916 stats_.stream_bytes_received += |
914 last_stream_frames_[i].data.TotalBufferSize(); | 917 last_stream_frames_[i].data.TotalBufferSize(); |
915 } | 918 } |
916 | |
917 // Process window updates, blocked, stream resets, acks, then congestion | 919 // Process window updates, blocked, stream resets, acks, then congestion |
918 // feedback. | 920 // feedback. |
919 if (!last_window_update_frames_.empty()) { | 921 if (!last_window_update_frames_.empty()) { |
920 visitor_->OnWindowUpdateFrames(last_window_update_frames_); | 922 visitor_->OnWindowUpdateFrames(last_window_update_frames_); |
| 923 if (!connected_ && !FLAGS_quic_stop_early) { |
| 924 return; |
| 925 } |
921 } | 926 } |
922 if (!last_blocked_frames_.empty()) { | 927 if (!last_blocked_frames_.empty()) { |
923 visitor_->OnBlockedFrames(last_blocked_frames_); | 928 visitor_->OnBlockedFrames(last_blocked_frames_); |
| 929 if (!connected_ && !FLAGS_quic_stop_early) { |
| 930 return; |
| 931 } |
924 } | 932 } |
925 for (size_t i = 0; i < last_goaway_frames_.size(); ++i) { | 933 for (size_t i = 0; i < last_goaway_frames_.size(); ++i) { |
926 visitor_->OnGoAway(last_goaway_frames_[i]); | 934 visitor_->OnGoAway(last_goaway_frames_[i]); |
| 935 if (!connected_ && !FLAGS_quic_stop_early) { |
| 936 return; |
| 937 } |
927 } | 938 } |
928 for (size_t i = 0; i < last_rst_frames_.size(); ++i) { | 939 for (size_t i = 0; i < last_rst_frames_.size(); ++i) { |
929 visitor_->OnRstStream(last_rst_frames_[i]); | 940 visitor_->OnRstStream(last_rst_frames_[i]); |
| 941 if (!connected_ && !FLAGS_quic_stop_early) { |
| 942 return; |
| 943 } |
930 } | 944 } |
931 for (size_t i = 0; i < last_ack_frames_.size(); ++i) { | 945 for (size_t i = 0; i < last_ack_frames_.size(); ++i) { |
932 ProcessAckFrame(last_ack_frames_[i]); | 946 ProcessAckFrame(last_ack_frames_[i]); |
| 947 if (!connected_ && !FLAGS_quic_stop_early) { |
| 948 return; |
| 949 } |
933 } | 950 } |
934 for (size_t i = 0; i < last_stop_waiting_frames_.size(); ++i) { | 951 for (size_t i = 0; i < last_stop_waiting_frames_.size(); ++i) { |
935 ProcessStopWaitingFrame(last_stop_waiting_frames_[i]); | 952 ProcessStopWaitingFrame(last_stop_waiting_frames_[i]); |
| 953 if (!connected_ && !FLAGS_quic_stop_early) { |
| 954 return; |
| 955 } |
936 } | 956 } |
937 if (!last_close_frames_.empty()) { | 957 if (!last_close_frames_.empty()) { |
938 CloseConnection(last_close_frames_[0].error_code, true); | 958 CloseConnection(last_close_frames_[0].error_code, true); |
939 DCHECK(!connected_); | 959 DCHECK(!connected_); |
| 960 if (!FLAGS_quic_stop_early) { |
| 961 return; |
| 962 } |
940 } | 963 } |
941 | 964 |
942 // If there are new missing packets to report, send an ack immediately. | 965 // If there are new missing packets to report, send an ack immediately. |
943 if (received_packet_manager_.HasNewMissingPackets()) { | 966 if (received_packet_manager_.HasNewMissingPackets()) { |
944 ack_queued_ = true; | 967 ack_queued_ = true; |
945 ack_alarm_->Cancel(); | 968 ack_alarm_->Cancel(); |
946 } | 969 } |
947 | 970 |
948 UpdateStopWaitingCount(); | 971 UpdateStopWaitingCount(); |
949 ClearLastFrames(); | 972 ClearLastFrames(); |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2134 } | 2157 } |
2135 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2158 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2136 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2159 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2137 return true; | 2160 return true; |
2138 } | 2161 } |
2139 } | 2162 } |
2140 return false; | 2163 return false; |
2141 } | 2164 } |
2142 | 2165 |
2143 } // namespace net | 2166 } // namespace net |
OLD | NEW |