| 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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 if (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA && | 1684 if (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA && |
| 1685 last_send_for_timeout_ <= time_of_last_received_packet_) { | 1685 last_send_for_timeout_ <= time_of_last_received_packet_) { |
| 1686 last_send_for_timeout_ = packet_send_time; | 1686 last_send_for_timeout_ = packet_send_time; |
| 1687 } | 1687 } |
| 1688 } | 1688 } |
| 1689 SetPingAlarm(); | 1689 SetPingAlarm(); |
| 1690 MaybeSetMtuAlarm(); | 1690 MaybeSetMtuAlarm(); |
| 1691 DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " | 1691 DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " |
| 1692 << packet_send_time.ToDebuggingValue(); | 1692 << packet_send_time.ToDebuggingValue(); |
| 1693 | 1693 |
| 1694 if (!FLAGS_quic_simple_packet_number_length_2) { | |
| 1695 // TODO(ianswett): Change the packet number length and other packet creator | |
| 1696 // options by a more explicit API than setting a struct value directly, | |
| 1697 // perhaps via the NetworkChangeVisitor. | |
| 1698 packet_generator_.UpdateSequenceNumberLength( | |
| 1699 sent_packet_manager_->GetLeastUnacked(packet->path_id), | |
| 1700 sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); | |
| 1701 } | |
| 1702 | |
| 1703 bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( | 1694 bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( |
| 1704 packet, packet->original_path_id, packet->original_packet_number, | 1695 packet, packet->original_path_id, packet->original_packet_number, |
| 1705 packet_send_time, packet->transmission_type, IsRetransmittable(*packet)); | 1696 packet_send_time, packet->transmission_type, IsRetransmittable(*packet)); |
| 1706 | 1697 |
| 1707 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { | 1698 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { |
| 1708 SetRetransmissionAlarm(); | 1699 SetRetransmissionAlarm(); |
| 1709 } | 1700 } |
| 1710 | 1701 |
| 1711 if (FLAGS_quic_simple_packet_number_length_2) { | 1702 // The packet number length must be updated after OnPacketSent, because it |
| 1712 // The packet number length must be updated after OnPacketSent, because it | 1703 // may change the packet number length in packet. |
| 1713 // may change the packet number length in packet. | 1704 packet_generator_.UpdateSequenceNumberLength( |
| 1714 packet_generator_.UpdateSequenceNumberLength( | 1705 sent_packet_manager_->GetLeastUnacked(packet->path_id), |
| 1715 sent_packet_manager_->GetLeastUnacked(packet->path_id), | 1706 sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); |
| 1716 sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); | |
| 1717 } | |
| 1718 | 1707 |
| 1719 stats_.bytes_sent += result.bytes_written; | 1708 stats_.bytes_sent += result.bytes_written; |
| 1720 ++stats_.packets_sent; | 1709 ++stats_.packets_sent; |
| 1721 if (packet->transmission_type != NOT_RETRANSMISSION) { | 1710 if (packet->transmission_type != NOT_RETRANSMISSION) { |
| 1722 stats_.bytes_retransmitted += result.bytes_written; | 1711 stats_.bytes_retransmitted += result.bytes_written; |
| 1723 ++stats_.packets_retransmitted; | 1712 ++stats_.packets_retransmitted; |
| 1724 } | 1713 } |
| 1725 | 1714 |
| 1726 // In some cases, an MTU probe can cause ERR_MSG_TOO_BIG. This indicates that | 1715 // In some cases, an MTU probe can cause ERR_MSG_TOO_BIG. This indicates that |
| 1727 // the MTU discovery is permanently unsuccessful. | 1716 // the MTU discovery is permanently unsuccessful. |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2536 | 2525 |
| 2537 void QuicConnection::CheckIfApplicationLimited() { | 2526 void QuicConnection::CheckIfApplicationLimited() { |
| 2538 if (queued_packets_.empty() && | 2527 if (queued_packets_.empty() && |
| 2539 !sent_packet_manager_->HasPendingRetransmissions() && | 2528 !sent_packet_manager_->HasPendingRetransmissions() && |
| 2540 !visitor_->WillingAndAbleToWrite()) { | 2529 !visitor_->WillingAndAbleToWrite()) { |
| 2541 sent_packet_manager_->OnApplicationLimited(); | 2530 sent_packet_manager_->OnApplicationLimited(); |
| 2542 } | 2531 } |
| 2543 } | 2532 } |
| 2544 | 2533 |
| 2545 } // namespace net | 2534 } // namespace net |
| OLD | NEW |