| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; | 139 bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; |
| 140 bool OnBlockedFrame(const QuicBlockedFrame& frame) override; | 140 bool OnBlockedFrame(const QuicBlockedFrame& frame) override; |
| 141 bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override; | 141 bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override; |
| 142 void OnPacketComplete() override; | 142 void OnPacketComplete() override; |
| 143 | 143 |
| 144 // QuicBufferedPacketStore::VisitorInterface implementation. | 144 // QuicBufferedPacketStore::VisitorInterface implementation. |
| 145 void OnExpiredPackets(QuicConnectionId connection_id, | 145 void OnExpiredPackets(QuicConnectionId connection_id, |
| 146 QuicBufferedPacketStore::BufferedPacketList | 146 QuicBufferedPacketStore::BufferedPacketList |
| 147 early_arrived_packets) override; | 147 early_arrived_packets) override; |
| 148 | 148 |
| 149 // Create connections for previously buffered CHLOs as many as allowed. |
| 150 virtual void ProcessBufferedChlos(size_t max_connections_to_create); |
| 151 |
| 152 // Return true if there is CHLO buffered. |
| 153 virtual bool HasChlosBuffered() const; |
| 154 |
| 149 protected: | 155 protected: |
| 150 virtual QuicServerSessionBase* CreateQuicSession( | 156 virtual QuicServerSessionBase* CreateQuicSession( |
| 151 QuicConnectionId connection_id, | 157 QuicConnectionId connection_id, |
| 152 const IPEndPoint& client_address) = 0; | 158 const IPEndPoint& client_address) = 0; |
| 153 | 159 |
| 154 // Called when a connection is rejected statelessly. | 160 // Called when a connection is rejected statelessly. |
| 155 virtual void OnConnectionRejectedStatelessly(); | 161 virtual void OnConnectionRejectedStatelessly(); |
| 156 | 162 |
| 157 // Called when a connection is closed statelessly. | 163 // Called when a connection is closed statelessly. |
| 158 virtual void OnConnectionClosedStatelessly(QuicErrorCode error); | 164 virtual void OnConnectionClosedStatelessly(QuicErrorCode error); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // Returns a fate which describes what subsequent processing should be | 276 // Returns a fate which describes what subsequent processing should be |
| 271 // performed on the packets, like ValidityChecks. | 277 // performed on the packets, like ValidityChecks. |
| 272 QuicPacketFate MaybeRejectStatelessly(QuicConnectionId connection_id, | 278 QuicPacketFate MaybeRejectStatelessly(QuicConnectionId connection_id, |
| 273 const QuicPacketHeader& header); | 279 const QuicPacketHeader& header); |
| 274 | 280 |
| 275 // Deliver |packets| to |session| for further processing. | 281 // Deliver |packets| to |session| for further processing. |
| 276 void DeliverPacketsToSession( | 282 void DeliverPacketsToSession( |
| 277 const std::list<QuicBufferedPacketStore::BufferedPacket>& packets, | 283 const std::list<QuicBufferedPacketStore::BufferedPacket>& packets, |
| 278 QuicServerSessionBase* session); | 284 QuicServerSessionBase* session); |
| 279 | 285 |
| 286 void set_new_sessions_allowed_per_event_loop( |
| 287 int16_t new_sessions_allowed_per_event_loop) { |
| 288 new_sessions_allowed_per_event_loop_ = new_sessions_allowed_per_event_loop; |
| 289 } |
| 290 |
| 280 const QuicConfig& config_; | 291 const QuicConfig& config_; |
| 281 | 292 |
| 282 const QuicCryptoServerConfig* crypto_config_; | 293 const QuicCryptoServerConfig* crypto_config_; |
| 283 | 294 |
| 284 // The cache for most recently compressed certs. | 295 // The cache for most recently compressed certs. |
| 285 QuicCompressedCertsCache compressed_certs_cache_; | 296 QuicCompressedCertsCache compressed_certs_cache_; |
| 286 | 297 |
| 287 // The list of connections waiting to write. | 298 // The list of connections waiting to write. |
| 288 WriteBlockedList write_blocked_list_; | 299 WriteBlockedList write_blocked_list_; |
| 289 | 300 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 333 |
| 323 // Used to get the supported versions based on flag. Does not own. | 334 // Used to get the supported versions based on flag. Does not own. |
| 324 QuicVersionManager* version_manager_; | 335 QuicVersionManager* version_manager_; |
| 325 | 336 |
| 326 QuicFramer framer_; | 337 QuicFramer framer_; |
| 327 | 338 |
| 328 // The last error set by SetLastError(), which is called by | 339 // The last error set by SetLastError(), which is called by |
| 329 // framer_visitor_->OnError(). | 340 // framer_visitor_->OnError(). |
| 330 QuicErrorCode last_error_; | 341 QuicErrorCode last_error_; |
| 331 | 342 |
| 343 // A backward counter of how many new sessions can be create within current |
| 344 // event loop. When reaches 0, it means can't create sessions for now. |
| 345 int16_t new_sessions_allowed_per_event_loop_; |
| 346 |
| 332 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 347 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 333 }; | 348 }; |
| 334 | 349 |
| 335 } // namespace net | 350 } // namespace net |
| 336 | 351 |
| 337 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 352 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |