| 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 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 class QuicPacketWriterWrapper; | 47 class QuicPacketWriterWrapper; |
| 48 | 48 |
| 49 namespace test { | 49 namespace test { |
| 50 class QuicDispatcherPeer; | 50 class QuicDispatcherPeer; |
| 51 } // namespace test | 51 } // namespace test |
| 52 | 52 |
| 53 class DeleteSessionsAlarm; | 53 class DeleteSessionsAlarm; |
| 54 class QuicEpollConnectionHelper; | 54 class QuicEpollConnectionHelper; |
| 55 | 55 |
| 56 class QuicDispatcher : public QuicPacketWriter, public QuicSessionOwner { | 56 class QuicDispatcher : public QuicPacketWriter, |
| 57 public QuicServerSessionVisitor { |
| 57 public: | 58 public: |
| 58 // Ideally we'd have a linked_hash_set: the boolean is unused. | 59 // Ideally we'd have a linked_hash_set: the boolean is unused. |
| 59 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; | 60 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; |
| 60 | 61 |
| 61 // Due to the way delete_sessions_closure_ is registered, the Dispatcher | 62 // Due to the way delete_sessions_closure_ is registered, the Dispatcher |
| 62 // must live until epoll_server Shutdown. |supported_versions| specifies the | 63 // must live until epoll_server Shutdown. |supported_versions| specifies the |
| 63 // list of supported QUIC versions. | 64 // list of supported QUIC versions. |
| 64 QuicDispatcher(const QuicConfig& config, | 65 QuicDispatcher(const QuicConfig& config, |
| 65 const QuicCryptoServerConfig& crypto_config, | 66 const QuicCryptoServerConfig& crypto_config, |
| 66 const QuicVersionVector& supported_versions, | 67 const QuicVersionVector& supported_versions, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 88 | 89 |
| 89 // Called when the underyling connection becomes writable to allow | 90 // Called when the underyling connection becomes writable to allow |
| 90 // queued writes to happen. | 91 // queued writes to happen. |
| 91 // | 92 // |
| 92 // Returns true if more writes are possible, false otherwise. | 93 // Returns true if more writes are possible, false otherwise. |
| 93 virtual bool OnCanWrite(); | 94 virtual bool OnCanWrite(); |
| 94 | 95 |
| 95 // Sends ConnectionClose frames to all connected clients. | 96 // Sends ConnectionClose frames to all connected clients. |
| 96 void Shutdown(); | 97 void Shutdown(); |
| 97 | 98 |
| 99 // QuicServerSessionVisitor interface implementation: |
| 98 // Ensure that the closed connection is cleaned up asynchronously. | 100 // Ensure that the closed connection is cleaned up asynchronously. |
| 99 virtual void OnConnectionClosed(QuicGuid guid, QuicErrorCode error) OVERRIDE; | 101 virtual void OnConnectionClosed(QuicGuid guid, QuicErrorCode error) OVERRIDE; |
| 100 | 102 |
| 103 // Queues the blocked writer for later resumption. |
| 104 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) OVERRIDE; |
| 105 |
| 101 typedef base::hash_map<QuicGuid, QuicSession*> SessionMap; | 106 typedef base::hash_map<QuicGuid, QuicSession*> SessionMap; |
| 102 | 107 |
| 103 virtual QuicSession* CreateQuicSession( | 108 virtual QuicSession* CreateQuicSession( |
| 104 QuicGuid guid, | 109 QuicGuid guid, |
| 105 const IPEndPoint& server_address, | 110 const IPEndPoint& server_address, |
| 106 const IPEndPoint& client_address); | 111 const IPEndPoint& client_address); |
| 107 | 112 |
| 108 // Deletes all sessions on the closed session list and clears the list. | 113 // Deletes all sessions on the closed session list and clears the list. |
| 109 void DeleteSessions(); | 114 void DeleteSessions(); |
| 110 | 115 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 QuicFramer framer_; | 216 QuicFramer framer_; |
| 212 scoped_ptr<QuicFramerVisitor> framer_visitor_; | 217 scoped_ptr<QuicFramerVisitor> framer_visitor_; |
| 213 | 218 |
| 214 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 219 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 } // namespace tools | 222 } // namespace tools |
| 218 } // namespace net | 223 } // namespace net |
| 219 | 224 |
| 220 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 225 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |