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 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 packet_generator_.SetShouldSendAck(send_feedback, | 1596 packet_generator_.SetShouldSendAck(send_feedback, |
1597 version() > QUIC_VERSION_15); | 1597 version() > QUIC_VERSION_15); |
1598 } | 1598 } |
1599 | 1599 |
1600 void QuicConnection::OnRetransmissionTimeout() { | 1600 void QuicConnection::OnRetransmissionTimeout() { |
1601 if (!sent_packet_manager_.HasUnackedPackets()) { | 1601 if (!sent_packet_manager_.HasUnackedPackets()) { |
1602 return; | 1602 return; |
1603 } | 1603 } |
1604 | 1604 |
1605 sent_packet_manager_.OnRetransmissionTimeout(); | 1605 sent_packet_manager_.OnRetransmissionTimeout(); |
| 1606 WriteIfNotBlocked(); |
| 1607 // In the TLP case, the SentPacketManager gives the connection the opportunity |
| 1608 // to send new data before retransmitting. |
| 1609 if (sent_packet_manager_.MaybeRetransmitTailLossProbe()) { |
| 1610 // Send the pending retransmission now that it's been queued. |
| 1611 WriteIfNotBlocked(); |
| 1612 } |
1606 | 1613 |
1607 WriteIfNotBlocked(); | 1614 // Ensure the retransmission alarm is always set if there are unacked packets |
1608 | 1615 // and nothing waiting to be sent. |
1609 // Ensure the retransmission alarm is always set if there are unacked packets. | |
1610 if (!HasQueuedData() && !retransmission_alarm_->IsSet()) { | 1616 if (!HasQueuedData() && !retransmission_alarm_->IsSet()) { |
1611 QuicTime rto_timeout = sent_packet_manager_.GetRetransmissionTime(); | 1617 QuicTime rto_timeout = sent_packet_manager_.GetRetransmissionTime(); |
1612 if (rto_timeout != QuicTime::Zero()) { | 1618 if (rto_timeout != QuicTime::Zero()) { |
1613 retransmission_alarm_->Set(rto_timeout); | 1619 retransmission_alarm_->Set(rto_timeout); |
1614 } | 1620 } |
1615 } | 1621 } |
1616 } | 1622 } |
1617 | 1623 |
1618 void QuicConnection::SetEncrypter(EncryptionLevel level, | 1624 void QuicConnection::SetEncrypter(EncryptionLevel level, |
1619 QuicEncrypter* encrypter) { | 1625 QuicEncrypter* encrypter) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 // If we changed the generator's batch state, restore original batch state. | 1962 // If we changed the generator's batch state, restore original batch state. |
1957 if (!already_in_batch_mode_) { | 1963 if (!already_in_batch_mode_) { |
1958 DVLOG(1) << "Leaving Batch Mode."; | 1964 DVLOG(1) << "Leaving Batch Mode."; |
1959 connection_->packet_generator_.FinishBatchOperations(); | 1965 connection_->packet_generator_.FinishBatchOperations(); |
1960 } | 1966 } |
1961 DCHECK_EQ(already_in_batch_mode_, | 1967 DCHECK_EQ(already_in_batch_mode_, |
1962 connection_->packet_generator_.InBatchMode()); | 1968 connection_->packet_generator_.InBatchMode()); |
1963 } | 1969 } |
1964 | 1970 |
1965 } // namespace net | 1971 } // namespace net |
OLD | NEW |