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

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

Issue 138503006: Create an interface for explicit notification of Dispatcher about (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 guids in time wait state by discarding the packet and 5 // Handles packets for guids in time wait state by discarding the packet and
6 // sending the clients a public reset packet with exponential backoff. 6 // sending the clients a public reset packet with exponential backoff.
7 7
8 #ifndef NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ 8 #ifndef NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_
9 #define NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ 9 #define NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_
10 10
11 #include <deque> 11 #include <deque>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
16 #include "net/quic/quic_blocked_writer_interface.h" 16 #include "net/quic/quic_blocked_writer_interface.h"
17 #include "net/quic/quic_framer.h" 17 #include "net/quic/quic_framer.h"
18 #include "net/quic/quic_packet_writer.h" 18 #include "net/quic/quic_packet_writer.h"
19 #include "net/quic/quic_protocol.h" 19 #include "net/quic/quic_protocol.h"
20 #include "net/tools/epoll_server/epoll_server.h" 20 #include "net/tools/epoll_server/epoll_server.h"
21 #include "net/tools/quic/quic_epoll_clock.h" 21 #include "net/tools/quic/quic_epoll_clock.h"
22 22
23 namespace net { 23 namespace net {
24 namespace tools { 24 namespace tools {
25 25
26 class GuidCleanUpAlarm; 26 class GuidCleanUpAlarm;
27 class QuicServerSessionVisitor;
27 28
28 namespace test { 29 namespace test {
29 class QuicTimeWaitListManagerPeer; 30 class QuicTimeWaitListManagerPeer;
30 } // namespace test 31 } // namespace test
31 32
32 // Maintains a list of all guids that have been recently closed. A guid lives in 33 // Maintains a list of all guids that have been recently closed. A guid lives in
33 // this state for kTimeWaitPeriod. All packets received for guids in this state 34 // this state for kTimeWaitPeriod. All packets received for guids in this state
34 // are handed over to the QuicTimeWaitListManager by the QuicDispatcher. 35 // are handed over to the QuicTimeWaitListManager by the QuicDispatcher.
35 // Decides whether to send a public reset packet, a copy of the previously sent 36 // Decides whether to send a public reset packet, a copy of the previously sent
36 // connection close packet, or nothing to the client which sent a packet 37 // connection close packet, or nothing to the client which sent a packet
37 // with the guid in time wait state. After the guid expires its time wait 38 // with the guid in time wait state. After the guid expires its time wait
38 // period, a new connection/session will be created if a packet is received 39 // period, a new connection/session will be created if a packet is received
39 // for this guid. 40 // for this guid.
40 class QuicTimeWaitListManager : public QuicBlockedWriterInterface { 41 class QuicTimeWaitListManager : public QuicBlockedWriterInterface {
41 public: 42 public:
42 // writer - the entity that writes to the socket. (Owned by the dispatcher) 43 // writer - the entity that writes to the socket. (Owned by the dispatcher)
44 // visitor - the entity that manages blocked writers. (The dispatcher)
43 // epoll_server - used to run clean up alarms. (Owned by the dispatcher) 45 // epoll_server - used to run clean up alarms. (Owned by the dispatcher)
44 QuicTimeWaitListManager(QuicPacketWriter* writer, 46 QuicTimeWaitListManager(QuicPacketWriter* writer,
47 QuicServerSessionVisitor* visitor,
45 EpollServer* epoll_server, 48 EpollServer* epoll_server,
46 const QuicVersionVector& supported_versions); 49 const QuicVersionVector& supported_versions);
47 virtual ~QuicTimeWaitListManager(); 50 virtual ~QuicTimeWaitListManager();
48 51
49 // Adds the given guid to time wait state for kTimeWaitPeriod. Henceforth, 52 // Adds the given guid to time wait state for kTimeWaitPeriod. Henceforth,
50 // any packet bearing this guid should not be processed while the guid remains 53 // any packet bearing this guid should not be processed while the guid remains
51 // in this list. If a non-NULL |close_packet| is provided, it is sent again 54 // in this list. If a non-NULL |close_packet| is provided, it is sent again
52 // when packets are received for added guids. If NULL, a public reset packet 55 // when packets are received for added guids. If NULL, a public reset packet
53 // is sent with the specified |version|. DCHECKs that guid is not already on 56 // is sent with the specified |version|. DCHECKs that guid is not already on
54 // the list. 57 // the list.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 134
132 // Maintains a list of GuidAddTime elements which it owns, in the 135 // Maintains a list of GuidAddTime elements which it owns, in the
133 // order they should be deleted. 136 // order they should be deleted.
134 std::deque<GuidAddTime*> time_ordered_guid_list_; 137 std::deque<GuidAddTime*> time_ordered_guid_list_;
135 138
136 // Pending public reset packets that need to be sent out to the client 139 // Pending public reset packets that need to be sent out to the client
137 // when we are given a chance to write by the dispatcher. 140 // when we are given a chance to write by the dispatcher.
138 std::deque<QueuedPacket*> pending_packets_queue_; 141 std::deque<QueuedPacket*> pending_packets_queue_;
139 142
140 // Used to schedule alarms to delete old guids which have been in the list for 143 // Used to schedule alarms to delete old guids which have been in the list for
141 // too long. Owned by the dispatcher. 144 // too long.
142 EpollServer* epoll_server_; 145 EpollServer* epoll_server_;
143 146
144 // Time period for which guids should remain in time wait state. 147 // Time period for which guids should remain in time wait state.
145 const QuicTime::Delta kTimeWaitPeriod_; 148 const QuicTime::Delta kTimeWaitPeriod_;
146 149
147 // Alarm registered with the epoll server to clean up guids that have out 150 // Alarm registered with the epoll server to clean up guids that have out
148 // lived their duration in time wait state. 151 // lived their duration in time wait state.
149 scoped_ptr<GuidCleanUpAlarm> guid_clean_up_alarm_; 152 scoped_ptr<GuidCleanUpAlarm> guid_clean_up_alarm_;
150 153
151 // Clock to efficiently measure approximate time from the epoll server. 154 // Clock to efficiently measure approximate time from the epoll server.
152 QuicEpollClock clock_; 155 QuicEpollClock clock_;
153 156
154 // Interface that writes given buffer to the socket. Owned by the dispatcher. 157 // Interface that writes given buffer to the socket.
155 QuicPacketWriter* writer_; 158 QuicPacketWriter* writer_;
156 159
160 // Interface that manages blocked writers.
161 QuicServerSessionVisitor* visitor_;
162
157 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); 163 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager);
158 }; 164 };
159 165
160 } // namespace tools 166 } // namespace tools
161 } // namespace net 167 } // namespace net
162 168
163 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ 169 #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