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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // QuicSessions. | 78 // QuicSessions. |
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); | |
91 | 89 |
92 // Called by the dispatcher when the underlying socket becomes writable again, | 90 // 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 | 91 // since we might need to send pending public reset packets which we didn't |
94 // send because the underlying socket was write blocked. | 92 // send because the underlying socket was write blocked. |
95 void OnCanWrite() override; | 93 void OnCanWrite() override; |
96 | 94 |
97 // Used to delete connection_id entries that have outlived their time wait | 95 // Used to delete connection_id entries that have outlived their time wait |
98 // period. | 96 // period. |
99 void CleanUpOldConnectionIds(); | 97 void CleanUpOldConnectionIds(); |
100 | 98 |
(...skipping 16 matching lines...) Expand all Loading... |
117 const QuicSocketAddress& server_address, | 115 const QuicSocketAddress& server_address, |
118 const QuicSocketAddress& client_address); | 116 const QuicSocketAddress& client_address); |
119 | 117 |
120 protected: | 118 protected: |
121 virtual std::unique_ptr<QuicEncryptedPacket> BuildPublicReset( | 119 virtual std::unique_ptr<QuicEncryptedPacket> BuildPublicReset( |
122 const QuicPublicResetPacket& packet); | 120 const QuicPublicResetPacket& packet); |
123 | 121 |
124 // Creates a public reset packet and sends it or queues it to be sent later. | 122 // Creates a public reset packet and sends it or queues it to be sent later. |
125 virtual void SendPublicReset(const QuicSocketAddress& server_address, | 123 virtual void SendPublicReset(const QuicSocketAddress& server_address, |
126 const QuicSocketAddress& client_address, | 124 const QuicSocketAddress& client_address, |
127 QuicConnectionId connection_id, | 125 QuicConnectionId connection_id); |
128 QuicPacketNumber rejected_packet_number); | |
129 | 126 |
130 private: | 127 private: |
131 friend class test::QuicDispatcherPeer; | 128 friend class test::QuicDispatcherPeer; |
132 friend class test::QuicTimeWaitListManagerPeer; | 129 friend class test::QuicTimeWaitListManagerPeer; |
133 | 130 |
134 // Internal structure to store pending public reset packets. | 131 // Internal structure to store pending public reset packets. |
135 class QueuedPacket; | 132 class QueuedPacket; |
136 | 133 |
137 // Decides if a packet should be sent for this connection_id based on the | 134 // Decides if a packet should be sent for this connection_id based on the |
138 // number of received packets. | 135 // number of received packets. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 202 |
206 // Interface that manages blocked writers. | 203 // Interface that manages blocked writers. |
207 Visitor* visitor_; | 204 Visitor* visitor_; |
208 | 205 |
209 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); | 206 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); |
210 }; | 207 }; |
211 | 208 |
212 } // namespace net | 209 } // namespace net |
213 | 210 |
214 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 211 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
OLD | NEW |