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 QuicSession, which demuxes a single connection to individual streams. | 5 // A QuicSession, which demuxes a single connection to individual streams. |
6 | 6 |
7 #ifndef NET_QUIC_QUIC_SESSION_H_ | 7 #ifndef NET_QUIC_QUIC_SESSION_H_ |
8 #define NET_QUIC_QUIC_SESSION_H_ | 8 #define NET_QUIC_QUIC_SESSION_H_ |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 Perspective perspective() const { return connection_->perspective(); } | 196 Perspective perspective() const { return connection_->perspective(); } |
197 | 197 |
198 QuicFlowController* flow_controller() { return &flow_controller_; } | 198 QuicFlowController* flow_controller() { return &flow_controller_; } |
199 | 199 |
200 // Returns true if connection is flow controller blocked. | 200 // Returns true if connection is flow controller blocked. |
201 bool IsConnectionFlowControlBlocked() const; | 201 bool IsConnectionFlowControlBlocked() const; |
202 | 202 |
203 // Returns true if any stream is flow controller blocked. | 203 // Returns true if any stream is flow controller blocked. |
204 bool IsStreamFlowControlBlocked(); | 204 bool IsStreamFlowControlBlocked(); |
205 | 205 |
206 size_t get_max_open_streams() const { return max_open_streams_; } | 206 size_t max_open_incoming_streams() const { |
| 207 return max_open_incoming_streams_; |
| 208 } |
207 | 209 |
208 size_t get_max_available_streams() const { | 210 size_t max_open_outgoing_streams() const { |
209 return max_open_streams_ * kMaxAvailableStreamsMultiplier; | 211 return max_open_outgoing_streams_; |
210 } | 212 } |
211 | 213 |
| 214 size_t MaxAvailableStreams() const; |
| 215 |
212 ReliableQuicStream* GetStream(const QuicStreamId stream_id); | 216 ReliableQuicStream* GetStream(const QuicStreamId stream_id); |
213 | 217 |
214 // Mark a stream as draining. | 218 // Mark a stream as draining. |
215 virtual void StreamDraining(QuicStreamId id); | 219 virtual void StreamDraining(QuicStreamId id); |
216 | 220 |
217 // Close the connection, if it is not already closed. | 221 // Close the connection, if it is not already closed. |
218 void CloseConnectionWithDetails(QuicErrorCode error, const char* details); | 222 void CloseConnectionWithDetails(QuicErrorCode error, const char* details); |
219 | 223 |
220 // Returns true if this stream should yield writes to another blocked stream. | 224 // Returns true if this stream should yield writes to another blocked stream. |
221 bool ShouldYield(QuicStreamId stream_id); | 225 bool ShouldYield(QuicStreamId stream_id); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 StreamMap& static_streams() { return static_stream_map_; } | 272 StreamMap& static_streams() { return static_stream_map_; } |
269 const StreamMap& static_streams() const { return static_stream_map_; } | 273 const StreamMap& static_streams() const { return static_stream_map_; } |
270 | 274 |
271 StreamMap& dynamic_streams() { return dynamic_stream_map_; } | 275 StreamMap& dynamic_streams() { return dynamic_stream_map_; } |
272 const StreamMap& dynamic_streams() const { return dynamic_stream_map_; } | 276 const StreamMap& dynamic_streams() const { return dynamic_stream_map_; } |
273 | 277 |
274 std::vector<ReliableQuicStream*>* closed_streams() { | 278 std::vector<ReliableQuicStream*>* closed_streams() { |
275 return &closed_streams_; | 279 return &closed_streams_; |
276 } | 280 } |
277 | 281 |
278 void set_max_open_streams(size_t max_open_streams); | 282 void set_max_open_incoming_streams(size_t max_open_incoming_streams); |
| 283 void set_max_open_outgoing_streams(size_t max_open_outgoing_streams); |
279 | 284 |
280 void set_largest_peer_created_stream_id( | 285 void set_largest_peer_created_stream_id( |
281 QuicStreamId largest_peer_created_stream_id) { | 286 QuicStreamId largest_peer_created_stream_id) { |
282 largest_peer_created_stream_id_ = largest_peer_created_stream_id; | 287 largest_peer_created_stream_id_ = largest_peer_created_stream_id; |
283 } | 288 } |
284 void set_error(QuicErrorCode error) { error_ = error; } | 289 void set_error(QuicErrorCode error) { error_ = error; } |
285 QuicWriteBlockedList* write_blocked_streams() { | 290 QuicWriteBlockedList* write_blocked_streams() { |
286 return &write_blocked_streams_; | 291 return &write_blocked_streams_; |
287 } | 292 } |
288 | 293 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // waiting for a definitive final highest offset from the peer. | 348 // waiting for a definitive final highest offset from the peer. |
344 std::map<QuicStreamId, QuicStreamOffset> | 349 std::map<QuicStreamId, QuicStreamOffset> |
345 locally_closed_streams_highest_offset_; | 350 locally_closed_streams_highest_offset_; |
346 | 351 |
347 scoped_ptr<QuicConnection> connection_; | 352 scoped_ptr<QuicConnection> connection_; |
348 | 353 |
349 std::vector<ReliableQuicStream*> closed_streams_; | 354 std::vector<ReliableQuicStream*> closed_streams_; |
350 | 355 |
351 QuicConfig config_; | 356 QuicConfig config_; |
352 | 357 |
353 // Returns the maximum number of streams this connection can open. | 358 // The maximum number of outgoing streams this connection can open. |
354 size_t max_open_streams_; | 359 size_t max_open_outgoing_streams_; |
| 360 |
| 361 // The maximum number of incoming streams this connection will allow. |
| 362 size_t max_open_incoming_streams_; |
355 | 363 |
356 // Static streams, such as crypto and header streams. Owned by child classes | 364 // Static streams, such as crypto and header streams. Owned by child classes |
357 // that create these streams. | 365 // that create these streams. |
358 StreamMap static_stream_map_; | 366 StreamMap static_stream_map_; |
359 | 367 |
360 // Map from StreamId to pointers to streams. Owns the streams. | 368 // Map from StreamId to pointers to streams. Owns the streams. |
361 StreamMap dynamic_stream_map_; | 369 StreamMap dynamic_stream_map_; |
362 | 370 |
363 // The ID to use for the next outgoing stream. | 371 // The ID to use for the next outgoing stream. |
364 QuicStreamId next_outgoing_stream_id_; | 372 QuicStreamId next_outgoing_stream_id_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // The stream id which was last popped in OnCanWrite, or 0, if not under the | 404 // The stream id which was last popped in OnCanWrite, or 0, if not under the |
397 // call stack of OnCanWrite. | 405 // call stack of OnCanWrite. |
398 QuicStreamId currently_writing_stream_id_; | 406 QuicStreamId currently_writing_stream_id_; |
399 | 407 |
400 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 408 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
401 }; | 409 }; |
402 | 410 |
403 } // namespace net | 411 } // namespace net |
404 | 412 |
405 #endif // NET_QUIC_QUIC_SESSION_H_ | 413 #endif // NET_QUIC_QUIC_SESSION_H_ |
OLD | NEW |