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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 virtual void SendVersionNegotiationPacket( | 113 virtual void SendVersionNegotiationPacket( |
114 QuicConnectionId connection_id, | 114 QuicConnectionId connection_id, |
115 const QuicVersionVector& supported_versions, | 115 const QuicVersionVector& supported_versions, |
116 const QuicSocketAddress& server_address, | 116 const QuicSocketAddress& server_address, |
117 const QuicSocketAddress& client_address); | 117 const QuicSocketAddress& client_address); |
118 | 118 |
119 protected: | 119 protected: |
120 virtual std::unique_ptr<QuicEncryptedPacket> BuildPublicReset( | 120 virtual std::unique_ptr<QuicEncryptedPacket> BuildPublicReset( |
121 const QuicPublicResetPacket& packet); | 121 const QuicPublicResetPacket& packet); |
122 | 122 |
| 123 // Creates a public reset packet and sends it or queues it to be sent later. |
| 124 virtual void SendPublicReset(const QuicSocketAddress& server_address, |
| 125 const QuicSocketAddress& client_address, |
| 126 QuicConnectionId connection_id, |
| 127 QuicPacketNumber rejected_packet_number); |
| 128 |
123 private: | 129 private: |
124 friend class test::QuicDispatcherPeer; | 130 friend class test::QuicDispatcherPeer; |
125 friend class test::QuicTimeWaitListManagerPeer; | 131 friend class test::QuicTimeWaitListManagerPeer; |
126 | 132 |
127 // Internal structure to store pending public reset packets. | 133 // Internal structure to store pending public reset packets. |
128 class QueuedPacket; | 134 class QueuedPacket; |
129 | 135 |
130 // Decides if a packet should be sent for this connection_id based on the | 136 // Decides if a packet should be sent for this connection_id based on the |
131 // number of received packets. | 137 // number of received packets. |
132 bool ShouldSendResponse(int received_packet_count); | 138 bool ShouldSendResponse(int received_packet_count); |
133 | 139 |
134 // Creates a public reset packet and sends it or queues it to be sent later. | |
135 void SendPublicReset(const QuicSocketAddress& server_address, | |
136 const QuicSocketAddress& client_address, | |
137 QuicConnectionId connection_id, | |
138 QuicPacketNumber rejected_packet_number); | |
139 | |
140 // Either sends the packet and deletes it or makes pending_packets_queue_ the | 140 // Either sends the packet and deletes it or makes pending_packets_queue_ the |
141 // owner of the packet. | 141 // owner of the packet. |
142 void SendOrQueuePacket(std::unique_ptr<QueuedPacket> packet); | 142 void SendOrQueuePacket(std::unique_ptr<QueuedPacket> packet); |
143 | 143 |
144 // Sends the packet out. Returns true if the packet was successfully consumed. | 144 // Sends the packet out. Returns true if the packet was successfully consumed. |
145 // If the writer got blocked and did not buffer the packet, we'll need to keep | 145 // If the writer got blocked and did not buffer the packet, we'll need to keep |
146 // the packet and retry sending. In case of all other errors we drop the | 146 // the packet and retry sending. In case of all other errors we drop the |
147 // packet. | 147 // packet. |
148 bool WriteToWire(QueuedPacket* packet); | 148 bool WriteToWire(QueuedPacket* packet); |
149 | 149 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 // Interface that manages blocked writers. | 205 // Interface that manages blocked writers. |
206 Visitor* visitor_; | 206 Visitor* visitor_; |
207 | 207 |
208 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); | 208 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); |
209 }; | 209 }; |
210 | 210 |
211 } // namespace net | 211 } // namespace net |
212 | 212 |
213 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 213 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
OLD | NEW |