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

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

Issue 1138443003: Land Recent QUIC Changes until 05/13/2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile error fixes Created 5 years, 7 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
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_
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const QuicVersionVector& supported_versions); 48 const QuicVersionVector& supported_versions);
49 ~QuicTimeWaitListManager() override; 49 ~QuicTimeWaitListManager() override;
50 50
51 // Adds the given connection_id to time wait state for time_wait_period_. 51 // Adds the given connection_id to time wait state for time_wait_period_.
52 // Henceforth, any packet bearing this connection_id should not be processed 52 // Henceforth, any packet bearing this connection_id should not be processed
53 // while the connection_id remains in this list. If a non-nullptr 53 // while the connection_id remains in this list. If a non-nullptr
54 // |close_packet| is provided, the TimeWaitListManager takes ownership of it 54 // |close_packet| is provided, the TimeWaitListManager takes ownership of it
55 // and sends it again when packets are received for added connection_ids. If 55 // and sends it again when packets are received for added connection_ids. If
56 // nullptr, a public reset packet is sent with the specified |version|. 56 // nullptr, a public reset packet is sent with the specified |version|.
57 // DCHECKs that connection_id is not already on the list. "virtual" to 57 // DCHECKs that connection_id is not already on the list. "virtual" to
58 // override in tests. 58 // override in tests. If "connection_rejected_statelessly" is true, it means
59 // that the connection was closed due to a stateless reject, and no close
60 // packet is expected. Any packets that are received for connection_id will
61 // be black-holed.
62 // TODO(jokulik): In the future, we plan send (redundant) SREJ packets back to
63 // the client in response to stray data-packets that arrive after the first
64 // SREJ. This requires some new plumbing, so we black-hole for now.
59 virtual void AddConnectionIdToTimeWait(QuicConnectionId connection_id, 65 virtual void AddConnectionIdToTimeWait(QuicConnectionId connection_id,
60 QuicVersion version, 66 QuicVersion version,
67 bool connection_rejected_statelessly,
61 QuicEncryptedPacket* close_packet); 68 QuicEncryptedPacket* close_packet);
62 69
63 // Returns true if the connection_id is in time wait state, false otherwise. 70 // Returns true if the connection_id is in time wait state, false otherwise.
64 // Packets received for this connection_id should not lead to creation of new 71 // Packets received for this connection_id should not lead to creation of new
65 // QuicSessions. 72 // QuicSessions.
66 bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) const; 73 bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) const;
67 74
68 // Called when a packet is received for a connection_id that is in time wait 75 // Called when a packet is received for a connection_id that is in time wait
69 // state. Sends a public reset packet to the client which sent this 76 // state. Sends a public reset packet to the client which sent this
70 // connection_id. Sending of the public reset packet is throttled by using 77 // connection_id. Sending of the public reset packet is throttled by using
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // false if the map is empty or the oldest connection has not expired. 145 // false if the map is empty or the oldest connection has not expired.
139 bool MaybeExpireOldestConnection(QuicTime expiration_time); 146 bool MaybeExpireOldestConnection(QuicTime expiration_time);
140 147
141 // A map from a recently closed connection_id to the number of packets 148 // A map from a recently closed connection_id to the number of packets
142 // received after the termination of the connection bound to the 149 // received after the termination of the connection bound to the
143 // connection_id. 150 // connection_id.
144 struct ConnectionIdData { 151 struct ConnectionIdData {
145 ConnectionIdData(int num_packets_, 152 ConnectionIdData(int num_packets_,
146 QuicVersion version_, 153 QuicVersion version_,
147 QuicTime time_added_, 154 QuicTime time_added_,
148 QuicEncryptedPacket* close_packet) 155 QuicEncryptedPacket* close_packet,
156 bool connection_rejected_statelessly)
149 : num_packets(num_packets_), 157 : num_packets(num_packets_),
150 version(version_), 158 version(version_),
151 time_added(time_added_), 159 time_added(time_added_),
152 close_packet(close_packet) {} 160 close_packet(close_packet),
161 connection_rejected_statelessly(connection_rejected_statelessly) {}
153 int num_packets; 162 int num_packets;
154 QuicVersion version; 163 QuicVersion version;
155 QuicTime time_added; 164 QuicTime time_added;
156 QuicEncryptedPacket* close_packet; 165 QuicEncryptedPacket* close_packet;
166 bool connection_rejected_statelessly;
157 }; 167 };
158 168
159 // linked_hash_map allows lookup by ConnectionId and traversal in add order. 169 // linked_hash_map allows lookup by ConnectionId and traversal in add order.
160 typedef linked_hash_map<QuicConnectionId, ConnectionIdData> ConnectionIdMap; 170 typedef linked_hash_map<QuicConnectionId, ConnectionIdData> ConnectionIdMap;
161 ConnectionIdMap connection_id_map_; 171 ConnectionIdMap connection_id_map_;
162 172
163 // Pending public reset packets that need to be sent out to the client 173 // Pending public reset packets that need to be sent out to the client
164 // when we are given a chance to write by the dispatcher. 174 // when we are given a chance to write by the dispatcher.
165 std::deque<QueuedPacket*> pending_packets_queue_; 175 std::deque<QueuedPacket*> pending_packets_queue_;
166 176
(...skipping 13 matching lines...) Expand all
180 // Interface that manages blocked writers. 190 // Interface that manages blocked writers.
181 QuicServerSessionVisitor* visitor_; 191 QuicServerSessionVisitor* visitor_;
182 192
183 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); 193 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager);
184 }; 194 };
185 195
186 } // namespace tools 196 } // namespace tools
187 } // namespace net 197 } // namespace net
188 198
189 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ 199 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_session_test.cc ('k') | net/tools/quic/quic_time_wait_list_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698