| 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 <vector> | 10 #include <vector> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Returns mutable config for this session. Returned config is owned | 107 // Returns mutable config for this session. Returned config is owned |
| 108 // by QuicSession. | 108 // by QuicSession. |
| 109 QuicConfig* config(); | 109 QuicConfig* config(); |
| 110 | 110 |
| 111 // Returns true if the stream existed previously and has been closed. | 111 // Returns true if the stream existed previously and has been closed. |
| 112 // Returns false if the stream is still active or if the stream has | 112 // Returns false if the stream is still active or if the stream has |
| 113 // not yet been created. | 113 // not yet been created. |
| 114 bool IsClosedStream(QuicStreamId id); | 114 bool IsClosedStream(QuicStreamId id); |
| 115 | 115 |
| 116 QuicConnection* connection() { return connection_.get(); } | 116 QuicConnection* connection() { return connection_.get(); } |
| 117 const QuicConnection* connection() const { return connection_.get(); } |
| 117 size_t num_active_requests() const { return stream_map_.size(); } | 118 size_t num_active_requests() const { return stream_map_.size(); } |
| 118 const IPEndPoint& peer_address() const { | 119 const IPEndPoint& peer_address() const { |
| 119 return connection_->peer_address(); | 120 return connection_->peer_address(); |
| 120 } | 121 } |
| 121 QuicGuid guid() const { return connection_->guid(); } | 122 QuicGuid guid() const { return connection_->guid(); } |
| 122 | 123 |
| 123 QuicPacketCreator::Options* options() { return connection()->options(); } | 124 QuicPacketCreator::Options* options() { return connection()->options(); } |
| 124 | 125 |
| 125 // Returns the number of currently open streams, including those which have | 126 // Returns the number of currently open streams, including those which have |
| 126 // been implicitly created. | 127 // been implicitly created. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 137 return goaway_received_; | 138 return goaway_received_; |
| 138 } | 139 } |
| 139 | 140 |
| 140 bool goaway_sent() const { | 141 bool goaway_sent() const { |
| 141 return goaway_sent_; | 142 return goaway_sent_; |
| 142 } | 143 } |
| 143 | 144 |
| 144 QuicSpdyDecompressor* decompressor() { return &decompressor_; } | 145 QuicSpdyDecompressor* decompressor() { return &decompressor_; } |
| 145 QuicSpdyCompressor* compressor() { return &compressor_; } | 146 QuicSpdyCompressor* compressor() { return &compressor_; } |
| 146 | 147 |
| 148 QuicErrorCode error() const { return error_; } |
| 149 |
| 147 protected: | 150 protected: |
| 148 // Creates a new stream, owned by the caller, to handle a peer-initiated | 151 // Creates a new stream, owned by the caller, to handle a peer-initiated |
| 149 // stream. Returns NULL and does error handling if the stream can not be | 152 // stream. Returns NULL and does error handling if the stream can not be |
| 150 // created. | 153 // created. |
| 151 virtual ReliableQuicStream* CreateIncomingReliableStream(QuicStreamId id) = 0; | 154 virtual ReliableQuicStream* CreateIncomingReliableStream(QuicStreamId id) = 0; |
| 152 | 155 |
| 153 // Create a new stream, owned by the caller, to handle a locally-initiated | 156 // Create a new stream, owned by the caller, to handle a locally-initiated |
| 154 // stream. Returns NULL if max streams have already been opened. | 157 // stream. Returns NULL if max streams have already been opened. |
| 155 virtual ReliableQuicStream* CreateOutgoingReliableStream() = 0; | 158 virtual ReliableQuicStream* CreateOutgoingReliableStream() = 0; |
| 156 | 159 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 167 | 170 |
| 168 // This is called after every call other than OnConnectionClose from the | 171 // This is called after every call other than OnConnectionClose from the |
| 169 // QuicConnectionVisitor to allow post-processing once the work has been done. | 172 // QuicConnectionVisitor to allow post-processing once the work has been done. |
| 170 // In this case, it deletes streams given that it's safe to do so (no other | 173 // In this case, it deletes streams given that it's safe to do so (no other |
| 171 // operations are being done on the streams at this time) | 174 // operations are being done on the streams at this time) |
| 172 virtual void PostProcessAfterData(); | 175 virtual void PostProcessAfterData(); |
| 173 | 176 |
| 174 base::hash_map<QuicStreamId, ReliableQuicStream*>* streams() { | 177 base::hash_map<QuicStreamId, ReliableQuicStream*>* streams() { |
| 175 return &stream_map_; | 178 return &stream_map_; |
| 176 } | 179 } |
| 180 |
| 181 const base::hash_map<QuicStreamId, ReliableQuicStream*>* streams() const { |
| 182 return &stream_map_; |
| 183 } |
| 184 |
| 177 std::vector<ReliableQuicStream*>* closed_streams() { | 185 std::vector<ReliableQuicStream*>* closed_streams() { |
| 178 return &closed_streams_; | 186 return &closed_streams_; |
| 179 } | 187 } |
| 180 | 188 |
| 181 size_t get_max_open_streams() const { | 189 size_t get_max_open_streams() const { |
| 182 return max_open_streams_; | 190 return max_open_streams_; |
| 183 } | 191 } |
| 184 | 192 |
| 185 void set_max_open_streams(size_t max_open_streams) { | 193 void set_max_open_streams(size_t max_open_streams) { |
| 186 max_open_streams_ = max_open_streams; | 194 max_open_streams_ = max_open_streams; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 229 |
| 222 // A list of streams which need to write more data. | 230 // A list of streams which need to write more data. |
| 223 BlockedList<QuicStreamId> write_blocked_streams_; | 231 BlockedList<QuicStreamId> write_blocked_streams_; |
| 224 | 232 |
| 225 // A map of headers waiting to be compressed, and the streams | 233 // A map of headers waiting to be compressed, and the streams |
| 226 // they are associated with. | 234 // they are associated with. |
| 227 map<uint32, QuicStreamId> decompression_blocked_streams_; | 235 map<uint32, QuicStreamId> decompression_blocked_streams_; |
| 228 | 236 |
| 229 QuicStreamId largest_peer_created_stream_id_; | 237 QuicStreamId largest_peer_created_stream_id_; |
| 230 | 238 |
| 239 // The latched error with which the connection was closed. |
| 240 QuicErrorCode error_; |
| 241 |
| 231 // Whether a GoAway has been received. | 242 // Whether a GoAway has been received. |
| 232 bool goaway_received_; | 243 bool goaway_received_; |
| 233 // Whether a GoAway has been sent. | 244 // Whether a GoAway has been sent. |
| 234 bool goaway_sent_; | 245 bool goaway_sent_; |
| 235 | 246 |
| 236 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 247 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 237 }; | 248 }; |
| 238 | 249 |
| 239 } // namespace net | 250 } // namespace net |
| 240 | 251 |
| 241 #endif // NET_QUIC_QUIC_SESSION_H_ | 252 #endif // NET_QUIC_QUIC_SESSION_H_ |
| OLD | NEW |