| 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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void QuicConnection::SendRstStream(QuicStreamId id, | 1230 void QuicConnection::SendRstStream(QuicStreamId id, |
| 1231 QuicRstStreamErrorCode error, | 1231 QuicRstStreamErrorCode error, |
| 1232 QuicStreamOffset bytes_written) { | 1232 QuicStreamOffset bytes_written) { |
| 1233 // Opportunistically bundle an ack with this outgoing packet. | 1233 // Opportunistically bundle an ack with this outgoing packet. |
| 1234 ScopedPacketBundler ack_bundler(this, SEND_ACK_IF_PENDING); | 1234 ScopedPacketBundler ack_bundler(this, SEND_ACK_IF_PENDING); |
| 1235 packet_generator_.AddControlFrame(QuicFrame(new QuicRstStreamFrame( | 1235 packet_generator_.AddControlFrame(QuicFrame(new QuicRstStreamFrame( |
| 1236 id, AdjustErrorForVersion(error, version()), bytes_written))); | 1236 id, AdjustErrorForVersion(error, version()), bytes_written))); |
| 1237 | 1237 |
| 1238 if (error == QUIC_STREAM_NO_ERROR && version() > QUIC_VERSION_28) { | 1238 if (error == QUIC_STREAM_NO_ERROR) { |
| 1239 // All data for streams which are reset with QUIC_STREAM_NO_ERROR must | 1239 // All data for streams which are reset with QUIC_STREAM_NO_ERROR must |
| 1240 // be received by the peer. | 1240 // be received by the peer. |
| 1241 return; | 1241 return; |
| 1242 } | 1242 } |
| 1243 | 1243 |
| 1244 sent_packet_manager_->CancelRetransmissionsForStream(id); | 1244 sent_packet_manager_->CancelRetransmissionsForStream(id); |
| 1245 // Remove all queued packets which only contain data for the reset stream. | 1245 // Remove all queued packets which only contain data for the reset stream. |
| 1246 QueuedPacketList::iterator packet_iterator = queued_packets_.begin(); | 1246 QueuedPacketList::iterator packet_iterator = queued_packets_.begin(); |
| 1247 while (packet_iterator != queued_packets_.end()) { | 1247 while (packet_iterator != queued_packets_.end()) { |
| 1248 QuicFrames* retransmittable_frames = | 1248 QuicFrames* retransmittable_frames = |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 // the sender and a signaling mechanism -- if the sender uses a | 2513 // the sender and a signaling mechanism -- if the sender uses a |
| 2514 // different MinRTO, we may get spurious retransmissions. May not have | 2514 // different MinRTO, we may get spurious retransmissions. May not have |
| 2515 // any benefits, but if the delayed ack becomes a significant source | 2515 // any benefits, but if the delayed ack becomes a significant source |
| 2516 // of (likely, tail) latency, then consider such a mechanism. | 2516 // of (likely, tail) latency, then consider such a mechanism. |
| 2517 const QuicTime::Delta QuicConnection::DelayedAckTime() { | 2517 const QuicTime::Delta QuicConnection::DelayedAckTime() { |
| 2518 return QuicTime::Delta::FromMilliseconds( | 2518 return QuicTime::Delta::FromMilliseconds( |
| 2519 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); | 2519 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); |
| 2520 } | 2520 } |
| 2521 | 2521 |
| 2522 } // namespace net | 2522 } // namespace net |
| OLD | NEW |