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 <map> | 10 #include <map> |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Create a new stream, owned by the caller, to handle a locally-initiated | 214 // Create a new stream, owned by the caller, to handle a locally-initiated |
215 // stream. Returns nullptr if max streams have already been opened. | 215 // stream. Returns nullptr if max streams have already been opened. |
216 virtual ReliableQuicStream* CreateOutgoingDynamicStream() = 0; | 216 virtual ReliableQuicStream* CreateOutgoingDynamicStream() = 0; |
217 | 217 |
218 // Return the reserved crypto stream. | 218 // Return the reserved crypto stream. |
219 virtual QuicCryptoStream* GetCryptoStream() = 0; | 219 virtual QuicCryptoStream* GetCryptoStream() = 0; |
220 | 220 |
221 // Adds 'stream' to the active stream map. | 221 // Adds 'stream' to the active stream map. |
222 virtual void ActivateStream(ReliableQuicStream* stream); | 222 virtual void ActivateStream(ReliableQuicStream* stream); |
223 | 223 |
224 // Returns the stream id for a new stream. | 224 // Returns the stream ID for a new outgoing stream, and increments the |
225 QuicStreamId GetNextStreamId(); | 225 // underlying counter. |
| 226 QuicStreamId GetNextOutgoingStreamId(); |
226 | 227 |
227 ReliableQuicStream* GetIncomingDynamicStream(QuicStreamId stream_id); | 228 ReliableQuicStream* GetIncomingDynamicStream(QuicStreamId stream_id); |
228 | 229 |
229 ReliableQuicStream* GetDynamicStream(const QuicStreamId stream_id); | 230 ReliableQuicStream* GetDynamicStream(const QuicStreamId stream_id); |
230 | 231 |
231 // This is called after every call other than OnConnectionClose from the | 232 // This is called after every call other than OnConnectionClose from the |
232 // QuicConnectionVisitor to allow post-processing once the work has been done. | 233 // QuicConnectionVisitor to allow post-processing once the work has been done. |
233 // In this case, it deletes streams given that it's safe to do so (no other | 234 // In this case, it deletes streams given that it's safe to do so (no other |
234 // operations are being done on the streams at this time) | 235 // operations are being done on the streams at this time) |
235 virtual void PostProcessAfterData(); | 236 virtual void PostProcessAfterData(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 301 |
301 // Returns the maximum number of streams this connection can open. | 302 // Returns the maximum number of streams this connection can open. |
302 size_t max_open_streams_; | 303 size_t max_open_streams_; |
303 | 304 |
304 // Static streams, such as crypto and header streams. Owned by child classes | 305 // Static streams, such as crypto and header streams. Owned by child classes |
305 // that create these streams. | 306 // that create these streams. |
306 StreamMap static_stream_map_; | 307 StreamMap static_stream_map_; |
307 | 308 |
308 // Map from StreamId to pointers to streams that are owned by the caller. | 309 // Map from StreamId to pointers to streams that are owned by the caller. |
309 StreamMap dynamic_stream_map_; | 310 StreamMap dynamic_stream_map_; |
310 QuicStreamId next_stream_id_; | 311 |
| 312 // The ID to use for the next outgoing stream. |
| 313 QuicStreamId next_outgoing_stream_id_; |
311 | 314 |
312 // Set of stream ids that are less than the largest stream id that has been | 315 // Set of stream ids that are less than the largest stream id that has been |
313 // received, but are nonetheless available to be created. | 316 // received, but are nonetheless available to be created. |
314 base::hash_set<QuicStreamId> available_streams_; | 317 base::hash_set<QuicStreamId> available_streams_; |
315 | 318 |
316 // Set of stream ids that are "draining" -- a FIN has been sent and received, | 319 // Set of stream ids that are "draining" -- a FIN has been sent and received, |
317 // but the stream object still exists because not all the received data has | 320 // but the stream object still exists because not all the received data has |
318 // been consumed. | 321 // been consumed. |
319 base::hash_set<QuicStreamId> draining_streams_; | 322 base::hash_set<QuicStreamId> draining_streams_; |
320 | 323 |
(...skipping 10 matching lines...) Expand all Loading... |
331 | 334 |
332 // Indicate if there is pending data for the crypto stream. | 335 // Indicate if there is pending data for the crypto stream. |
333 bool has_pending_handshake_; | 336 bool has_pending_handshake_; |
334 | 337 |
335 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 338 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
336 }; | 339 }; |
337 | 340 |
338 } // namespace net | 341 } // namespace net |
339 | 342 |
340 #endif // NET_QUIC_QUIC_SESSION_H_ | 343 #endif // NET_QUIC_QUIC_SESSION_H_ |
OLD | NEW |