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/core/quic_connection.h" | 5 #include "net/quic/core/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 16 matching lines...) Expand all Loading... |
27 #include "net/base/net_errors.h" | 27 #include "net/base/net_errors.h" |
28 #include "net/quic/core/crypto/crypto_protocol.h" | 28 #include "net/quic/core/crypto/crypto_protocol.h" |
29 #include "net/quic/core/crypto/quic_decrypter.h" | 29 #include "net/quic/core/crypto/quic_decrypter.h" |
30 #include "net/quic/core/crypto/quic_encrypter.h" | 30 #include "net/quic/core/crypto/quic_encrypter.h" |
31 #include "net/quic/core/proto/cached_network_parameters.pb.h" | 31 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
32 #include "net/quic/core/quic_bandwidth.h" | 32 #include "net/quic/core/quic_bandwidth.h" |
33 #include "net/quic/core/quic_bug_tracker.h" | 33 #include "net/quic/core/quic_bug_tracker.h" |
34 #include "net/quic/core/quic_config.h" | 34 #include "net/quic/core/quic_config.h" |
35 #include "net/quic/core/quic_flags.h" | 35 #include "net/quic/core/quic_flags.h" |
36 #include "net/quic/core/quic_packet_generator.h" | 36 #include "net/quic/core/quic_packet_generator.h" |
| 37 #include "net/quic/core/quic_pending_retransmission.h" |
37 #include "net/quic/core/quic_sent_packet_manager.h" | 38 #include "net/quic/core/quic_sent_packet_manager.h" |
38 #include "net/quic/core/quic_utils.h" | 39 #include "net/quic/core/quic_utils.h" |
39 | 40 |
40 using base::StringPiece; | 41 using base::StringPiece; |
41 using base::StringPrintf; | 42 using base::StringPrintf; |
42 using std::list; | 43 using std::list; |
43 using std::make_pair; | 44 using std::make_pair; |
44 using std::max; | 45 using std::max; |
45 using std::min; | 46 using std::min; |
46 using std::numeric_limits; | 47 using std::numeric_limits; |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 delete[] packet_iterator->encrypted_buffer; | 1437 delete[] packet_iterator->encrypted_buffer; |
1437 ClearSerializedPacket(&(*packet_iterator)); | 1438 ClearSerializedPacket(&(*packet_iterator)); |
1438 packet_iterator = queued_packets_.erase(packet_iterator); | 1439 packet_iterator = queued_packets_.erase(packet_iterator); |
1439 } | 1440 } |
1440 } | 1441 } |
1441 | 1442 |
1442 void QuicConnection::WritePendingRetransmissions() { | 1443 void QuicConnection::WritePendingRetransmissions() { |
1443 // Keep writing as long as there's a pending retransmission which can be | 1444 // Keep writing as long as there's a pending retransmission which can be |
1444 // written. | 1445 // written. |
1445 while (sent_packet_manager_->HasPendingRetransmissions()) { | 1446 while (sent_packet_manager_->HasPendingRetransmissions()) { |
1446 const PendingRetransmission pending = | 1447 const QuicPendingRetransmission pending = |
1447 sent_packet_manager_->NextPendingRetransmission(); | 1448 sent_packet_manager_->NextPendingRetransmission(); |
1448 if (!CanWrite(HAS_RETRANSMITTABLE_DATA)) { | 1449 if (!CanWrite(HAS_RETRANSMITTABLE_DATA)) { |
1449 break; | 1450 break; |
1450 } | 1451 } |
1451 | 1452 |
1452 // Re-packetize the frames with a new packet number for retransmission. | 1453 // Re-packetize the frames with a new packet number for retransmission. |
1453 // Retransmitted packets use the same packet number length as the | 1454 // Retransmitted packets use the same packet number length as the |
1454 // original. | 1455 // original. |
1455 // Flush the packet generator before making a new packet. | 1456 // Flush the packet generator before making a new packet. |
1456 // TODO(ianswett): Implement ReserializeAllFrames as a separate path that | 1457 // TODO(ianswett): Implement ReserializeAllFrames as a separate path that |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 | 2464 |
2464 void QuicConnection::CheckIfApplicationLimited() { | 2465 void QuicConnection::CheckIfApplicationLimited() { |
2465 if (queued_packets_.empty() && | 2466 if (queued_packets_.empty() && |
2466 !sent_packet_manager_->HasPendingRetransmissions() && | 2467 !sent_packet_manager_->HasPendingRetransmissions() && |
2467 !visitor_->WillingAndAbleToWrite()) { | 2468 !visitor_->WillingAndAbleToWrite()) { |
2468 sent_packet_manager_->OnApplicationLimited(); | 2469 sent_packet_manager_->OnApplicationLimited(); |
2469 } | 2470 } |
2470 } | 2471 } |
2471 | 2472 |
2472 } // namespace net | 2473 } // namespace net |
OLD | NEW |