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> |
11 #include <iterator> | 11 #include <iterator> |
12 #include <limits> | 12 #include <limits> |
13 #include <memory> | 13 #include <memory> |
14 #include <set> | 14 #include <set> |
15 #include <utility> | 15 #include <utility> |
16 | 16 |
17 #include "base/format_macros.h" | 17 #include "base/format_macros.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/ref_counted.h" | |
21 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
22 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
23 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
25 #include "net/base/address_family.h" | 24 #include "net/base/address_family.h" |
26 #include "net/base/ip_address.h" | 25 #include "net/base/ip_address.h" |
27 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
28 #include "net/quic/core/crypto/crypto_protocol.h" | 27 #include "net/quic/core/crypto/crypto_protocol.h" |
29 #include "net/quic/core/crypto/quic_decrypter.h" | 28 #include "net/quic/core/crypto/quic_decrypter.h" |
30 #include "net/quic/core/crypto/quic_encrypter.h" | 29 #include "net/quic/core/crypto/quic_encrypter.h" |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 } | 1108 } |
1110 | 1109 |
1111 pending_version_negotiation_packet_ = false; | 1110 pending_version_negotiation_packet_ = false; |
1112 } | 1111 } |
1113 | 1112 |
1114 QuicConsumedData QuicConnection::SendStreamData( | 1113 QuicConsumedData QuicConnection::SendStreamData( |
1115 QuicStreamId id, | 1114 QuicStreamId id, |
1116 QuicIOVector iov, | 1115 QuicIOVector iov, |
1117 QuicStreamOffset offset, | 1116 QuicStreamOffset offset, |
1118 bool fin, | 1117 bool fin, |
1119 scoped_refptr<QuicAckListenerInterface> listener) { | 1118 QuicReferenceCountedPointer<QuicAckListenerInterface> listener) { |
1120 if (!fin && iov.total_length == 0) { | 1119 if (!fin && iov.total_length == 0) { |
1121 QUIC_BUG << "Attempt to send empty stream frame"; | 1120 QUIC_BUG << "Attempt to send empty stream frame"; |
1122 return QuicConsumedData(0, false); | 1121 return QuicConsumedData(0, false); |
1123 } | 1122 } |
1124 | 1123 |
1125 // Opportunistically bundle an ack with every outgoing packet. | 1124 // Opportunistically bundle an ack with every outgoing packet. |
1126 // Particularly, we want to bundle with handshake packets since we don't know | 1125 // Particularly, we want to bundle with handshake packets since we don't know |
1127 // which decrypter will be used on an ack packet following a handshake | 1126 // which decrypter will be used on an ack packet following a handshake |
1128 // packet (a handshake packet from client to server could result in a REJ or a | 1127 // packet (a handshake packet from client to server could result in a REJ or a |
1129 // SHLO from the server, leading to two different decrypters at the server.) | 1128 // SHLO from the server, leading to two different decrypters at the server.) |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2459 | 2458 |
2460 void QuicConnection::CheckIfApplicationLimited() { | 2459 void QuicConnection::CheckIfApplicationLimited() { |
2461 if (queued_packets_.empty() && | 2460 if (queued_packets_.empty() && |
2462 !sent_packet_manager_->HasPendingRetransmissions() && | 2461 !sent_packet_manager_->HasPendingRetransmissions() && |
2463 !visitor_->WillingAndAbleToWrite()) { | 2462 !visitor_->WillingAndAbleToWrite()) { |
2464 sent_packet_manager_->OnApplicationLimited(); | 2463 sent_packet_manager_->OnApplicationLimited(); |
2465 } | 2464 } |
2466 } | 2465 } |
2467 | 2466 |
2468 } // namespace net | 2467 } // namespace net |
OLD | NEW |