Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: net/tools/quic/quic_time_wait_list_manager.h

Issue 2319013003: Clean up connection when a public reset packet is received. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/tools/quic/test_tools/quic_dispatcher_peer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_
11 11
12 #include <stddef.h> 12 #include <stddef.h>
13 13
14 #include <deque> 14 #include <deque>
15 #include <memory> 15 #include <memory>
16 16
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "net/base/linked_hash_map.h" 18 #include "net/base/linked_hash_map.h"
19 #include "net/quic/core/quic_blocked_writer_interface.h" 19 #include "net/quic/core/quic_blocked_writer_interface.h"
20 #include "net/quic/core/quic_connection.h" 20 #include "net/quic/core/quic_connection.h"
21 #include "net/quic/core/quic_framer.h" 21 #include "net/quic/core/quic_framer.h"
22 #include "net/quic/core/quic_packet_writer.h" 22 #include "net/quic/core/quic_packet_writer.h"
23 #include "net/quic/core/quic_protocol.h" 23 #include "net/quic/core/quic_protocol.h"
24 #include "net/quic/core/quic_server_session_base.h" 24 #include "net/quic/core/quic_server_session_base.h"
25 25
26 namespace net { 26 namespace net {
27 27
28 namespace test { 28 namespace test {
29 class QuicDispatcherPeer;
29 class QuicTimeWaitListManagerPeer; 30 class QuicTimeWaitListManagerPeer;
30 } // namespace test 31 } // namespace test
31 32
32 // Maintains a list of all connection_ids that have been recently closed. A 33 // Maintains a list of all connection_ids that have been recently closed. A
33 // connection_id lives in this state for time_wait_period_. All packets received 34 // connection_id lives in this state for time_wait_period_. All packets received
34 // for connection_ids in this state are handed over to the 35 // for connection_ids in this state are handed over to the
35 // QuicTimeWaitListManager by the QuicDispatcher. Decides whether to send a 36 // QuicTimeWaitListManager by the QuicDispatcher. Decides whether to send a
36 // public reset packet, a copy of the previously sent connection close packet, 37 // public reset packet, a copy of the previously sent connection close packet,
37 // or nothing to the client which sent a packet with the connection_id in time 38 // or nothing to the client which sent a packet with the connection_id in time
38 // wait state. After the connection_id expires its time wait period, a new 39 // wait state. After the connection_id expires its time wait period, a new
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 QuicConnectionId connection_id, 107 QuicConnectionId connection_id,
107 const QuicVersionVector& supported_versions, 108 const QuicVersionVector& supported_versions,
108 const IPEndPoint& server_address, 109 const IPEndPoint& server_address,
109 const IPEndPoint& client_address); 110 const IPEndPoint& client_address);
110 111
111 protected: 112 protected:
112 virtual QuicEncryptedPacket* BuildPublicReset( 113 virtual QuicEncryptedPacket* BuildPublicReset(
113 const QuicPublicResetPacket& packet); 114 const QuicPublicResetPacket& packet);
114 115
115 private: 116 private:
117 friend class test::QuicDispatcherPeer;
116 friend class test::QuicTimeWaitListManagerPeer; 118 friend class test::QuicTimeWaitListManagerPeer;
117 119
118 // Internal structure to store pending public reset packets. 120 // Internal structure to store pending public reset packets.
119 class QueuedPacket; 121 class QueuedPacket;
120 122
121 // Decides if a packet should be sent for this connection_id based on the 123 // Decides if a packet should be sent for this connection_id based on the
122 // number of received packets. 124 // number of received packets.
123 bool ShouldSendResponse(int received_packet_count); 125 bool ShouldSendResponse(int received_packet_count);
124 126
125 // Creates a public reset packet and sends it or queues it to be sent later. 127 // Creates a public reset packet and sends it or queues it to be sent later.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 197
196 // Interface that manages blocked writers. 198 // Interface that manages blocked writers.
197 QuicServerSessionBase::Visitor* visitor_; 199 QuicServerSessionBase::Visitor* visitor_;
198 200
199 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); 201 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager);
200 }; 202 };
201 203
202 } // namespace net 204 } // namespace net
203 205
204 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ 206 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/test_tools/quic_dispatcher_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698