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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 delegate); | 1114 delegate); |
1115 } | 1115 } |
1116 | 1116 |
1117 void QuicConnection::SendRstStream(QuicStreamId id, | 1117 void QuicConnection::SendRstStream(QuicStreamId id, |
1118 QuicRstStreamErrorCode error, | 1118 QuicRstStreamErrorCode error, |
1119 QuicStreamOffset bytes_written) { | 1119 QuicStreamOffset bytes_written) { |
1120 // Opportunistically bundle an ack with this outgoing packet. | 1120 // Opportunistically bundle an ack with this outgoing packet. |
1121 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); | 1121 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
1122 packet_generator_.AddControlFrame(QuicFrame(new QuicRstStreamFrame( | 1122 packet_generator_.AddControlFrame(QuicFrame(new QuicRstStreamFrame( |
1123 id, AdjustErrorForVersion(error, version()), bytes_written))); | 1123 id, AdjustErrorForVersion(error, version()), bytes_written))); |
| 1124 if (!FLAGS_quic_do_not_retransmit_for_reset_streams) { |
| 1125 return; |
| 1126 } |
| 1127 |
| 1128 sent_packet_manager_.CancelRetransmissionsForStream(id); |
| 1129 // Remove all queued packets which only contain data for the reset stream. |
| 1130 QueuedPacketList::iterator packet_iterator = queued_packets_.begin(); |
| 1131 while (packet_iterator != queued_packets_.end()) { |
| 1132 RetransmittableFrames* retransmittable_frames = |
| 1133 packet_iterator->serialized_packet.retransmittable_frames; |
| 1134 if (!retransmittable_frames) { |
| 1135 ++packet_iterator; |
| 1136 continue; |
| 1137 } |
| 1138 retransmittable_frames->RemoveFramesForStream(id); |
| 1139 if (!retransmittable_frames->frames().empty()) { |
| 1140 ++packet_iterator; |
| 1141 continue; |
| 1142 } |
| 1143 delete packet_iterator->serialized_packet.retransmittable_frames; |
| 1144 delete packet_iterator->serialized_packet.packet; |
| 1145 packet_iterator->serialized_packet.retransmittable_frames = nullptr; |
| 1146 packet_iterator->serialized_packet.packet = nullptr; |
| 1147 packet_iterator = queued_packets_.erase(packet_iterator); |
| 1148 } |
1124 } | 1149 } |
1125 | 1150 |
1126 void QuicConnection::SendWindowUpdate(QuicStreamId id, | 1151 void QuicConnection::SendWindowUpdate(QuicStreamId id, |
1127 QuicStreamOffset byte_offset) { | 1152 QuicStreamOffset byte_offset) { |
1128 // Opportunistically bundle an ack with this outgoing packet. | 1153 // Opportunistically bundle an ack with this outgoing packet. |
1129 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); | 1154 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
1130 packet_generator_.AddControlFrame( | 1155 packet_generator_.AddControlFrame( |
1131 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); | 1156 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); |
1132 } | 1157 } |
1133 | 1158 |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 } | 2120 } |
2096 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2121 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2097 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2122 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2098 return true; | 2123 return true; |
2099 } | 2124 } |
2100 } | 2125 } |
2101 return false; | 2126 return false; |
2102 } | 2127 } |
2103 | 2128 |
2104 } // namespace net | 2129 } // namespace net |
OLD | NEW |