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 // A server side dispatcher which dispatches a given client's data to their | 5 // A server side dispatcher which dispatches a given client's data to their |
6 // stream. | 6 // stream. |
7 | 7 |
8 #ifndef NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
9 #define NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 9 #define NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 | 12 |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
15 #include "net/quic/blocked_list.h" | 15 #include "net/quic/blocked_list.h" |
16 #include "net/quic/quic_blocked_writer_interface.h" | 16 #include "net/quic/quic_blocked_writer_interface.h" |
17 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
18 #include "net/tools/flip_server/epoll_server.h" | 18 #include "net/tools/flip_server/epoll_server.h" |
19 #include "net/tools/quic/quic_packet_writer.h" | 19 #include "net/tools/quic/quic_packet_writer.h" |
20 #include "net/tools/quic/quic_server_session.h" | 20 #include "net/tools/quic/quic_server_session.h" |
21 #include "net/tools/quic/quic_time_wait_list_manager.h" | 21 #include "net/tools/quic/quic_time_wait_list_manager.h" |
22 | 22 |
23 #if defined(COMPILER_GCC) | 23 #if defined(COMPILER_GCC) |
24 namespace BASE_HASH_NAMESPACE { | 24 namespace BASE_HASH_NAMESPACE { |
25 template<> | 25 template<> |
26 struct hash<net::QuicBlockedWriterInterface*> { | 26 struct hash<net::QuicBlockedWriterInterface*> { |
27 std::size_t operator()(const net::QuicBlockedWriterInterface* ptr) const { | 27 std::size_t operator()( |
| 28 const net::QuicBlockedWriterInterface* ptr) const { |
28 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 29 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
29 } | 30 } |
30 }; | 31 }; |
31 } | 32 } |
32 #endif | 33 #endif |
33 | 34 |
34 namespace gfe2 { | 35 namespace gfe2 { |
35 class EpollServer; | 36 class EpollServer; |
36 } | 37 } |
37 | 38 |
38 class QuicSession; | 39 class QuicSession; |
39 | 40 |
40 namespace net { | 41 namespace net { |
| 42 namespace tools { |
41 | 43 |
42 class DeleteSessionsAlarm; | 44 class DeleteSessionsAlarm; |
43 | 45 |
44 class QuicDispatcher : public QuicPacketWriter, public QuicSessionOwner { | 46 class QuicDispatcher : public QuicPacketWriter, public QuicSessionOwner { |
45 public: | 47 public: |
46 typedef BlockedList<QuicBlockedWriterInterface*> WriteBlockedList; | 48 typedef BlockedList<QuicBlockedWriterInterface*> WriteBlockedList; |
47 | 49 |
48 // Due to the way delete_sessions_closure_ is registered, the Dispatcher | 50 // Due to the way delete_sessions_closure_ is registered, the Dispatcher |
49 // must live until epoll_server Shutdown. | 51 // must live until epoll_server Shutdown. |
50 QuicDispatcher(int fd, EpollServer* epoll_server); | 52 QuicDispatcher(int fd, EpollServer* epoll_server); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // The connection for client-server communication | 118 // The connection for client-server communication |
117 int fd_; | 119 int fd_; |
118 | 120 |
119 // True if the session is write blocked due to the socket returning EAGAIN. | 121 // True if the session is write blocked due to the socket returning EAGAIN. |
120 // False if we have gotten a call to OnCanWrite after the last failed write. | 122 // False if we have gotten a call to OnCanWrite after the last failed write. |
121 bool write_blocked_; | 123 bool write_blocked_; |
122 | 124 |
123 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 125 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
124 }; | 126 }; |
125 | 127 |
126 } // namespace net | 128 } // namespace tools |
| 129 } // namespace net |
127 | 130 |
128 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 131 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
OLD | NEW |