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 // Handles packets for connection_ids in time wait state by discarding the | 5 // Handles packets for connection_ids in time wait state by discarding the |
6 // packet and sending the clients a public reset packet with exponential | 6 // packet and sending the clients a public reset packet with exponential |
7 // backoff. | 7 // backoff. |
8 | 8 |
9 #ifndef NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 9 #ifndef NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
10 #define NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 10 #define NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) const; | 79 bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) const; |
80 | 80 |
81 // Called when a packet is received for a connection_id that is in time wait | 81 // Called when a packet is received for a connection_id that is in time wait |
82 // state. Sends a public reset packet to the client which sent this | 82 // state. Sends a public reset packet to the client which sent this |
83 // connection_id. Sending of the public reset packet is throttled by using | 83 // connection_id. Sending of the public reset packet is throttled by using |
84 // exponential back off. DCHECKs for the connection_id to be in time wait | 84 // exponential back off. DCHECKs for the connection_id to be in time wait |
85 // state. virtual to override in tests. | 85 // state. virtual to override in tests. |
86 virtual void ProcessPacket(const QuicSocketAddress& server_address, | 86 virtual void ProcessPacket(const QuicSocketAddress& server_address, |
87 const QuicSocketAddress& client_address, | 87 const QuicSocketAddress& client_address, |
88 QuicConnectionId connection_id, | 88 QuicConnectionId connection_id, |
89 QuicPacketNumber packet_number, | |
90 const QuicEncryptedPacket& packet); | 89 const QuicEncryptedPacket& packet); |
91 | 90 |
92 // Called by the dispatcher when the underlying socket becomes writable again, | 91 // Called by the dispatcher when the underlying socket becomes writable again, |
93 // since we might need to send pending public reset packets which we didn't | 92 // since we might need to send pending public reset packets which we didn't |
94 // send because the underlying socket was write blocked. | 93 // send because the underlying socket was write blocked. |
95 void OnCanWrite() override; | 94 void OnCanWrite() override; |
96 | 95 |
97 // Used to delete connection_id entries that have outlived their time wait | 96 // Used to delete connection_id entries that have outlived their time wait |
98 // period. | 97 // period. |
99 void CleanUpOldConnectionIds(); | 98 void CleanUpOldConnectionIds(); |
(...skipping 17 matching lines...) Expand all Loading... |
117 const QuicSocketAddress& server_address, | 116 const QuicSocketAddress& server_address, |
118 const QuicSocketAddress& client_address); | 117 const QuicSocketAddress& client_address); |
119 | 118 |
120 protected: | 119 protected: |
121 virtual std::unique_ptr<QuicEncryptedPacket> BuildPublicReset( | 120 virtual std::unique_ptr<QuicEncryptedPacket> BuildPublicReset( |
122 const QuicPublicResetPacket& packet); | 121 const QuicPublicResetPacket& packet); |
123 | 122 |
124 // Creates a public reset packet and sends it or queues it to be sent later. | 123 // Creates a public reset packet and sends it or queues it to be sent later. |
125 virtual void SendPublicReset(const QuicSocketAddress& server_address, | 124 virtual void SendPublicReset(const QuicSocketAddress& server_address, |
126 const QuicSocketAddress& client_address, | 125 const QuicSocketAddress& client_address, |
127 QuicConnectionId connection_id, | 126 QuicConnectionId connection_id); |
128 QuicPacketNumber rejected_packet_number); | |
129 | 127 |
130 private: | 128 private: |
131 friend class test::QuicDispatcherPeer; | 129 friend class test::QuicDispatcherPeer; |
132 friend class test::QuicTimeWaitListManagerPeer; | 130 friend class test::QuicTimeWaitListManagerPeer; |
133 | 131 |
134 // Internal structure to store pending public reset packets. | 132 // Internal structure to store pending public reset packets. |
135 class QueuedPacket; | 133 class QueuedPacket; |
136 | 134 |
137 // Decides if a packet should be sent for this connection_id based on the | 135 // Decides if a packet should be sent for this connection_id based on the |
138 // number of received packets. | 136 // number of received packets. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 203 |
206 // Interface that manages blocked writers. | 204 // Interface that manages blocked writers. |
207 Visitor* visitor_; | 205 Visitor* visitor_; |
208 | 206 |
209 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); | 207 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); |
210 }; | 208 }; |
211 | 209 |
212 } // namespace net | 210 } // namespace net |
213 | 211 |
214 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 212 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
OLD | NEW |