| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #ifndef NET_QUIC_QUIC_BUFFERED_PACKET_STORE_H_ | 5 #ifndef NET_QUIC_QUIC_BUFFERED_PACKET_STORE_H_ |
| 6 #define NET_QUIC_QUIC_BUFFERED_PACKET_STORE_H_ | 6 #define NET_QUIC_QUIC_BUFFERED_PACKET_STORE_H_ |
| 7 | 7 |
| 8 #include "net/base/ip_address.h" | 8 #include "net/base/ip_address.h" |
| 9 #include "net/base/linked_hash_map.h" | 9 #include "net/base/linked_hash_map.h" |
| 10 #include "net/quic/core/quic_alarm.h" | 10 #include "net/quic/core/quic_alarm.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 bool is_chlo); | 95 bool is_chlo); |
| 96 | 96 |
| 97 // Returns true if there are any packets buffered for |connection_id|. | 97 // Returns true if there are any packets buffered for |connection_id|. |
| 98 bool HasBufferedPackets(QuicConnectionId connection_id) const; | 98 bool HasBufferedPackets(QuicConnectionId connection_id) const; |
| 99 | 99 |
| 100 // Returns the list of buffered packets for |connection_id| and removes them | 100 // Returns the list of buffered packets for |connection_id| and removes them |
| 101 // from the store. Returns an empty list if no early arrived packets for this | 101 // from the store. Returns an empty list if no early arrived packets for this |
| 102 // connection are present. | 102 // connection are present. |
| 103 std::list<BufferedPacket> DeliverPackets(QuicConnectionId connection_id); | 103 std::list<BufferedPacket> DeliverPackets(QuicConnectionId connection_id); |
| 104 | 104 |
| 105 // Discards packets buffered for |connection_id|, if any. |
| 106 void DiscardPackets(QuicConnectionId connection_id); |
| 107 |
| 105 // Examines how long packets have been buffered in the store for each | 108 // Examines how long packets have been buffered in the store for each |
| 106 // connection. If they stay too long, removes them for new coming packets and | 109 // connection. If they stay too long, removes them for new coming packets and |
| 107 // calls |visitor_|'s OnPotentialConnectionExpire(). | 110 // calls |visitor_|'s OnPotentialConnectionExpire(). |
| 108 // Resets the alarm at the end. | 111 // Resets the alarm at the end. |
| 109 void OnExpirationTimeout(); | 112 void OnExpirationTimeout(); |
| 110 | 113 |
| 111 // Delivers buffered packets for next connection with CHLO to open. | 114 // Delivers buffered packets for next connection with CHLO to open. |
| 112 // Return connection id for next connection in |connection_id| | 115 // Return connection id for next connection in |connection_id| |
| 113 // and all buffered packets including CHLO. | 116 // and all buffered packets including CHLO. |
| 114 // The returned std::list should at least has one packet(CHLO) if | 117 // The returned std::list should at least has one packet(CHLO) if |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 std::unique_ptr<QuicAlarm> expiration_alarm_; | 151 std::unique_ptr<QuicAlarm> expiration_alarm_; |
| 149 | 152 |
| 150 // Keeps track of connection with CHLO buffered up already and the order they | 153 // Keeps track of connection with CHLO buffered up already and the order they |
| 151 // arrive. | 154 // arrive. |
| 152 linked_hash_map<QuicConnectionId, bool> connections_with_chlo_; | 155 linked_hash_map<QuicConnectionId, bool> connections_with_chlo_; |
| 153 }; | 156 }; |
| 154 | 157 |
| 155 } // namespace net | 158 } // namespace net |
| 156 | 159 |
| 157 #endif // NET_QUIC_QUIC_BUFFERED_PACKET_STORE_H_ | 160 #endif // NET_QUIC_QUIC_BUFFERED_PACKET_STORE_H_ |
| OLD | NEW |