| 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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 } | 1680 } |
| 1681 SetPingAlarm(); | 1681 SetPingAlarm(); |
| 1682 MaybeSetMtuAlarm(); | 1682 MaybeSetMtuAlarm(); |
| 1683 DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " | 1683 DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " |
| 1684 << packet_send_time.ToDebuggingValue(); | 1684 << packet_send_time.ToDebuggingValue(); |
| 1685 | 1685 |
| 1686 if (!FLAGS_quic_simple_packet_number_length) { | 1686 if (!FLAGS_quic_simple_packet_number_length) { |
| 1687 // TODO(ianswett): Change the packet number length and other packet creator | 1687 // TODO(ianswett): Change the packet number length and other packet creator |
| 1688 // options by a more explicit API than setting a struct value directly, | 1688 // options by a more explicit API than setting a struct value directly, |
| 1689 // perhaps via the NetworkChangeVisitor. | 1689 // perhaps via the NetworkChangeVisitor. |
| 1690 packet_generator_.UpdateSequenceNumberLength( | 1690 if (FLAGS_quic_least_unacked_packet_number_length) { |
| 1691 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), | 1691 packet_generator_.UpdateSequenceNumberLength( |
| 1692 sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); | 1692 sent_packet_manager_->GetLeastUnacked(packet->path_id), |
| 1693 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1694 max_packet_length())); |
| 1695 } else { |
| 1696 packet_generator_.UpdateSequenceNumberLength( |
| 1697 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
| 1698 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1699 max_packet_length())); |
| 1700 } |
| 1693 } | 1701 } |
| 1694 | 1702 |
| 1695 bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( | 1703 bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( |
| 1696 packet, packet->original_path_id, packet->original_packet_number, | 1704 packet, packet->original_path_id, packet->original_packet_number, |
| 1697 packet_send_time, packet->transmission_type, IsRetransmittable(*packet)); | 1705 packet_send_time, packet->transmission_type, IsRetransmittable(*packet)); |
| 1698 | 1706 |
| 1699 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { | 1707 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { |
| 1700 SetRetransmissionAlarm(); | 1708 SetRetransmissionAlarm(); |
| 1701 } | 1709 } |
| 1702 | 1710 |
| 1703 if (FLAGS_quic_simple_packet_number_length) { | 1711 if (FLAGS_quic_simple_packet_number_length) { |
| 1704 // The packet number length must be updated after OnPacketSent, because it | 1712 // The packet number length must be updated after OnPacketSent, because it |
| 1705 // may change the packet number length in packet. | 1713 // may change the packet number length in packet. |
| 1706 packet_generator_.UpdateSequenceNumberLength( | 1714 if (FLAGS_quic_least_unacked_packet_number_length) { |
| 1707 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), | 1715 packet_generator_.UpdateSequenceNumberLength( |
| 1708 sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); | 1716 sent_packet_manager_->GetLeastUnacked(packet->path_id), |
| 1717 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1718 max_packet_length())); |
| 1719 } else { |
| 1720 packet_generator_.UpdateSequenceNumberLength( |
| 1721 sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
| 1722 sent_packet_manager_->EstimateMaxPacketsInFlight( |
| 1723 max_packet_length())); |
| 1724 } |
| 1709 } | 1725 } |
| 1710 | 1726 |
| 1711 stats_.bytes_sent += result.bytes_written; | 1727 stats_.bytes_sent += result.bytes_written; |
| 1712 ++stats_.packets_sent; | 1728 ++stats_.packets_sent; |
| 1713 if (packet->transmission_type != NOT_RETRANSMISSION) { | 1729 if (packet->transmission_type != NOT_RETRANSMISSION) { |
| 1714 stats_.bytes_retransmitted += result.bytes_written; | 1730 stats_.bytes_retransmitted += result.bytes_written; |
| 1715 ++stats_.packets_retransmitted; | 1731 ++stats_.packets_retransmitted; |
| 1716 } | 1732 } |
| 1717 | 1733 |
| 1718 if (result.status == WRITE_STATUS_ERROR) { | 1734 if (result.status == WRITE_STATUS_ERROR) { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 // the sender and a signaling mechanism -- if the sender uses a | 2525 // the sender and a signaling mechanism -- if the sender uses a |
| 2510 // different MinRTO, we may get spurious retransmissions. May not have | 2526 // different MinRTO, we may get spurious retransmissions. May not have |
| 2511 // any benefits, but if the delayed ack becomes a significant source | 2527 // any benefits, but if the delayed ack becomes a significant source |
| 2512 // of (likely, tail) latency, then consider such a mechanism. | 2528 // of (likely, tail) latency, then consider such a mechanism. |
| 2513 const QuicTime::Delta QuicConnection::DelayedAckTime() { | 2529 const QuicTime::Delta QuicConnection::DelayedAckTime() { |
| 2514 return QuicTime::Delta::FromMilliseconds( | 2530 return QuicTime::Delta::FromMilliseconds( |
| 2515 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); | 2531 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); |
| 2516 } | 2532 } |
| 2517 | 2533 |
| 2518 } // namespace net | 2534 } // namespace net |
| OLD | NEW |