| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 QuicPacketWriter* writer() { return writer_.get(); } | 197 QuicPacketWriter* writer() { return writer_.get(); } |
| 198 | 198 |
| 199 // Creates per-connection packet writers out of the QuicDispatcher's shared | 199 // Creates per-connection packet writers out of the QuicDispatcher's shared |
| 200 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must | 200 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must |
| 201 // always be the same as the shared writer's IsWriteBlocked(), or else the | 201 // always be the same as the shared writer's IsWriteBlocked(), or else the |
| 202 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be | 202 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be |
| 203 // cleaned up for bug 16950226.) | 203 // cleaned up for bug 16950226.) |
| 204 virtual QuicPacketWriter* CreatePerConnectionWriter(); | 204 virtual QuicPacketWriter* CreatePerConnectionWriter(); |
| 205 | 205 |
| 206 // Returns true if a session should be created for a connection with an |
| 207 // unknown version identified by |version_tag|. |
| 208 virtual bool ShouldCreateSessionForUnknownVersion(QuicTag version_tag); |
| 209 |
| 206 void SetLastError(QuicErrorCode error); | 210 void SetLastError(QuicErrorCode error); |
| 207 | 211 |
| 208 private: | 212 private: |
| 209 friend class net::test::QuicDispatcherPeer; | 213 friend class net::test::QuicDispatcherPeer; |
| 210 | 214 |
| 211 // Removes the session from the session map and write blocked list, and adds | 215 // Removes the session from the session map and write blocked list, and adds |
| 212 // the ConnectionId to the time-wait list. If |session_closed_statelessly| is | 216 // the ConnectionId to the time-wait list. If |session_closed_statelessly| is |
| 213 // true, any future packets for the ConnectionId will be black-holed. | 217 // true, any future packets for the ConnectionId will be black-holed. |
| 214 void CleanUpSession(SessionMap::iterator it, bool session_closed_statelessly); | 218 void CleanUpSession(SessionMap::iterator it, bool session_closed_statelessly); |
| 215 | 219 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 242 // This vector contains QUIC versions which we currently support. | 246 // This vector contains QUIC versions which we currently support. |
| 243 // This should be ordered such that the highest supported version is the first | 247 // This should be ordered such that the highest supported version is the first |
| 244 // element, with subsequent elements in descending order (versions can be | 248 // element, with subsequent elements in descending order (versions can be |
| 245 // skipped as necessary). | 249 // skipped as necessary). |
| 246 const QuicVersionVector supported_versions_; | 250 const QuicVersionVector supported_versions_; |
| 247 | 251 |
| 248 // Information about the packet currently being handled. | 252 // Information about the packet currently being handled. |
| 249 IPEndPoint current_client_address_; | 253 IPEndPoint current_client_address_; |
| 250 IPEndPoint current_server_address_; | 254 IPEndPoint current_server_address_; |
| 251 const QuicEncryptedPacket* current_packet_; | 255 const QuicEncryptedPacket* current_packet_; |
| 256 QuicConnectionId current_connection_id_; |
| 252 | 257 |
| 253 QuicFramer framer_; | 258 QuicFramer framer_; |
| 254 | 259 |
| 255 // The last error set by SetLastError(), which is called by | 260 // The last error set by SetLastError(), which is called by |
| 256 // framer_visitor_->OnError(). | 261 // framer_visitor_->OnError(). |
| 257 QuicErrorCode last_error_; | 262 QuicErrorCode last_error_; |
| 258 | 263 |
| 259 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 264 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 260 }; | 265 }; |
| 261 | 266 |
| 262 } // namespace net | 267 } // namespace net |
| 263 | 268 |
| 264 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 269 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |