| 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 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 if (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA && | 1674 if (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA && |
| 1675 last_send_for_timeout_ <= time_of_last_received_packet_) { | 1675 last_send_for_timeout_ <= time_of_last_received_packet_) { |
| 1676 last_send_for_timeout_ = packet_send_time; | 1676 last_send_for_timeout_ = packet_send_time; |
| 1677 } | 1677 } |
| 1678 } | 1678 } |
| 1679 SetPingAlarm(); | 1679 SetPingAlarm(); |
| 1680 MaybeSetMtuAlarm(); | 1680 MaybeSetMtuAlarm(); |
| 1681 DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " | 1681 DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " |
| 1682 << packet_send_time.ToDebuggingValue(); | 1682 << packet_send_time.ToDebuggingValue(); |
| 1683 | 1683 |
| 1684 if (!FLAGS_quic_simple_packet_number_length) { | 1684 if (!FLAGS_quic_simple_packet_number_length_2) { |
| 1685 // TODO(ianswett): Change the packet number length and other packet creator | 1685 // TODO(ianswett): Change the packet number length and other packet creator |
| 1686 // options by a more explicit API than setting a struct value directly, | 1686 // options by a more explicit API than setting a struct value directly, |
| 1687 // perhaps via the NetworkChangeVisitor. | 1687 // perhaps via the NetworkChangeVisitor. |
| 1688 if (FLAGS_quic_least_unacked_packet_number_length) { | 1688 if (FLAGS_quic_least_unacked_packet_number_length) { |
| 1689 packet_generator_.UpdateSequenceNumberLength( | 1689 packet_generator_.UpdateSequenceNumberLength( |
| 1690 sent_packet_manager_->GetLeastUnacked(packet->path_id), | 1690 sent_packet_manager_->GetLeastUnacked(packet->path_id), |
| 1691 sent_packet_manager_->EstimateMaxPacketsInFlight( | 1691 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1692 max_packet_length())); | 1692 max_packet_length())); |
| 1693 } else { | 1693 } else { |
| 1694 packet_generator_.UpdateSequenceNumberLength( | 1694 packet_generator_.UpdateSequenceNumberLength( |
| 1695 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), | 1695 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
| 1696 sent_packet_manager_->EstimateMaxPacketsInFlight( | 1696 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1697 max_packet_length())); | 1697 max_packet_length())); |
| 1698 } | 1698 } |
| 1699 } | 1699 } |
| 1700 | 1700 |
| 1701 bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( | 1701 bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( |
| 1702 packet, packet->original_path_id, packet->original_packet_number, | 1702 packet, packet->original_path_id, packet->original_packet_number, |
| 1703 packet_send_time, packet->transmission_type, IsRetransmittable(*packet)); | 1703 packet_send_time, packet->transmission_type, IsRetransmittable(*packet)); |
| 1704 | 1704 |
| 1705 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { | 1705 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { |
| 1706 SetRetransmissionAlarm(); | 1706 SetRetransmissionAlarm(); |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 if (FLAGS_quic_simple_packet_number_length) { | 1709 if (FLAGS_quic_simple_packet_number_length_2) { |
| 1710 // The packet number length must be updated after OnPacketSent, because it | 1710 // The packet number length must be updated after OnPacketSent, because it |
| 1711 // may change the packet number length in packet. | 1711 // may change the packet number length in packet. |
| 1712 if (FLAGS_quic_least_unacked_packet_number_length) { | 1712 if (FLAGS_quic_least_unacked_packet_number_length) { |
| 1713 packet_generator_.UpdateSequenceNumberLength( | 1713 packet_generator_.UpdateSequenceNumberLength( |
| 1714 sent_packet_manager_->GetLeastUnacked(packet->path_id), | 1714 sent_packet_manager_->GetLeastUnacked(packet->path_id), |
| 1715 sent_packet_manager_->EstimateMaxPacketsInFlight( | 1715 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1716 max_packet_length())); | 1716 max_packet_length())); |
| 1717 } else { | 1717 } else { |
| 1718 packet_generator_.UpdateSequenceNumberLength( | 1718 packet_generator_.UpdateSequenceNumberLength( |
| 1719 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), | 1719 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 | 2553 |
| 2554 void QuicConnection::CheckIfApplicationLimited() { | 2554 void QuicConnection::CheckIfApplicationLimited() { |
| 2555 if (queued_packets_.empty() && | 2555 if (queued_packets_.empty() && |
| 2556 !sent_packet_manager_->HasPendingRetransmissions() && | 2556 !sent_packet_manager_->HasPendingRetransmissions() && |
| 2557 !visitor_->WillingAndAbleToWrite()) { | 2557 !visitor_->WillingAndAbleToWrite()) { |
| 2558 sent_packet_manager_->OnApplicationLimited(); | 2558 sent_packet_manager_->OnApplicationLimited(); |
| 2559 } | 2559 } |
| 2560 } | 2560 } |
| 2561 | 2561 |
| 2562 } // namespace net | 2562 } // namespace net |
| OLD | NEW |