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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 // duplicate packet being sent. The helper must call OnCanWrite | 1692 // duplicate packet being sent. The helper must call OnCanWrite |
1693 // when the write completes, and OnWriteError if an error occurs. | 1693 // when the write completes, and OnWriteError if an error occurs. |
1694 if (!writer_->IsWriteBlockedDataBuffered()) { | 1694 if (!writer_->IsWriteBlockedDataBuffered()) { |
1695 return false; | 1695 return false; |
1696 } | 1696 } |
1697 } | 1697 } |
1698 | 1698 |
1699 if (FLAGS_quic_only_track_sent_packets) { | 1699 if (FLAGS_quic_only_track_sent_packets) { |
1700 // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the | 1700 // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the |
1701 // MTU discovery is permanently unsuccessful. | 1701 // MTU discovery is permanently unsuccessful. |
1702 if (FLAGS_graceful_emsgsize_on_mtu_probe && | 1702 if (result.status == WRITE_STATUS_ERROR && |
1703 result.status == WRITE_STATUS_ERROR && | |
1704 result.error_code == kMessageTooBigErrorCode && | 1703 result.error_code == kMessageTooBigErrorCode && |
1705 packet->retransmittable_frames.empty() && | 1704 packet->retransmittable_frames.empty() && |
1706 packet->encrypted_length > long_term_mtu_) { | 1705 packet->encrypted_length > long_term_mtu_) { |
1707 mtu_discovery_target_ = 0; | 1706 mtu_discovery_target_ = 0; |
1708 mtu_discovery_alarm_->Cancel(); | 1707 mtu_discovery_alarm_->Cancel(); |
1709 // The write failed, but the writer is not blocked, so return true. | 1708 // The write failed, but the writer is not blocked, so return true. |
1710 return true; | 1709 return true; |
1711 } | 1710 } |
1712 | 1711 |
1713 if (result.status == WRITE_STATUS_ERROR) { | 1712 if (result.status == WRITE_STATUS_ERROR) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 stats_.bytes_sent += result.bytes_written; | 1761 stats_.bytes_sent += result.bytes_written; |
1763 ++stats_.packets_sent; | 1762 ++stats_.packets_sent; |
1764 if (packet->transmission_type != NOT_RETRANSMISSION) { | 1763 if (packet->transmission_type != NOT_RETRANSMISSION) { |
1765 stats_.bytes_retransmitted += result.bytes_written; | 1764 stats_.bytes_retransmitted += result.bytes_written; |
1766 ++stats_.packets_retransmitted; | 1765 ++stats_.packets_retransmitted; |
1767 } | 1766 } |
1768 | 1767 |
1769 if (!FLAGS_quic_only_track_sent_packets) { | 1768 if (!FLAGS_quic_only_track_sent_packets) { |
1770 // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the | 1769 // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the |
1771 // MTU discovery is permanently unsuccessful. | 1770 // MTU discovery is permanently unsuccessful. |
1772 if (FLAGS_graceful_emsgsize_on_mtu_probe && | 1771 if (result.status == WRITE_STATUS_ERROR && |
1773 result.status == WRITE_STATUS_ERROR && | |
1774 result.error_code == kMessageTooBigErrorCode && | 1772 result.error_code == kMessageTooBigErrorCode && |
1775 packet->retransmittable_frames.empty() && | 1773 packet->retransmittable_frames.empty() && |
1776 packet->encrypted_length > long_term_mtu_) { | 1774 packet->encrypted_length > long_term_mtu_) { |
1777 mtu_discovery_target_ = 0; | 1775 mtu_discovery_target_ = 0; |
1778 mtu_discovery_alarm_->Cancel(); | 1776 mtu_discovery_alarm_->Cancel(); |
1779 return true; | 1777 return true; |
1780 } | 1778 } |
1781 | 1779 |
1782 if (result.status == WRITE_STATUS_ERROR) { | 1780 if (result.status == WRITE_STATUS_ERROR) { |
1783 OnWriteError(result.error_code); | 1781 OnWriteError(result.error_code); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 | 2580 |
2583 void QuicConnection::CheckIfApplicationLimited() { | 2581 void QuicConnection::CheckIfApplicationLimited() { |
2584 if (queued_packets_.empty() && | 2582 if (queued_packets_.empty() && |
2585 !sent_packet_manager_->HasPendingRetransmissions() && | 2583 !sent_packet_manager_->HasPendingRetransmissions() && |
2586 !visitor_->WillingAndAbleToWrite()) { | 2584 !visitor_->WillingAndAbleToWrite()) { |
2587 sent_packet_manager_->OnApplicationLimited(); | 2585 sent_packet_manager_->OnApplicationLimited(); |
2588 } | 2586 } |
2589 } | 2587 } |
2590 | 2588 |
2591 } // namespace net | 2589 } // namespace net |
OLD | NEW |