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 client specific QuicSession subclass. This class owns the underlying | 5 // A client specific QuicSession subclass. This class owns the underlying |
6 // QuicConnection and QuicConnectionHelper objects. The connection stores | 6 // QuicConnection and QuicConnectionHelper objects. The connection stores |
7 // a non-owning pointer to the helper so this session needs to ensure that | 7 // a non-owning pointer to the helper so this session needs to ensure that |
8 // the helper outlives the connection. | 8 // the helper outlives the connection. |
9 | 9 |
10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 // Gets the SSL connection information. | 170 // Gets the SSL connection information. |
171 bool GetSSLInfo(SSLInfo* ssl_info) const; | 171 bool GetSSLInfo(SSLInfo* ssl_info) const; |
172 | 172 |
173 // Performs a crypto handshake with the server. | 173 // Performs a crypto handshake with the server. |
174 int CryptoConnect(bool require_confirmation, | 174 int CryptoConnect(bool require_confirmation, |
175 const CompletionCallback& callback); | 175 const CompletionCallback& callback); |
176 | 176 |
177 // Resumes a crypto handshake with the server after a timeout. | 177 // Resumes a crypto handshake with the server after a timeout. |
178 int ResumeCryptoConnect(const CompletionCallback& callback); | 178 int ResumeCryptoConnect(const CompletionCallback& callback); |
179 | 179 |
180 // Causes the QuicConnectionHelper to start reading from the socket | 180 // Causes the QuicConnectionHelper to start reading from all sockets |
181 // and passing the data along to the QuicConnection. | 181 // and passing the data along to the QuicConnection. |
182 void StartReading(); | 182 void StartReading(); |
183 | 183 |
184 // Close the session because of |error| and notifies the factory | 184 // Close the session because of |error| and notifies the factory |
185 // that this session has been closed, which will delete the session. | 185 // that this session has been closed, which will delete the session. |
186 void CloseSessionOnError(int error, QuicErrorCode quic_error); | 186 void CloseSessionOnError(int error, QuicErrorCode quic_error); |
187 | 187 |
188 // Close the session because of |error| and notifies the factory later that | 188 // Close the session because of |error| and notifies the factory later that |
189 // this session has been closed, which will delete the session. | 189 // this session has been closed, which will delete the session. |
190 void CloseSessionOnErrorAndNotifyFactoryLater(int error, | 190 void CloseSessionOnErrorAndNotifyFactoryLater(int error, |
(...skipping 12 matching lines...) Expand all Loading... | |
203 | 203 |
204 // Returns true if |hostname| may be pooled onto this session. If this | 204 // Returns true if |hostname| may be pooled onto this session. If this |
205 // is a secure QUIC session, then |hostname| must match the certificate | 205 // is a secure QUIC session, then |hostname| must match the certificate |
206 // presented during the handshake. | 206 // presented during the handshake. |
207 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; | 207 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; |
208 | 208 |
209 const QuicServerId& server_id() const { return server_id_; } | 209 const QuicServerId& server_id() const { return server_id_; } |
210 | 210 |
211 QuicDisabledReason disabled_reason() const { return disabled_reason_; } | 211 QuicDisabledReason disabled_reason() const { return disabled_reason_; } |
212 | 212 |
213 // Call to add a new socket to the session. Takes ownership of |socket|. | |
214 void AddSocket(scoped_ptr<DatagramClientSocket> socket); | |
Ryan Hamilton
2015/09/08 04:09:38
Do we ever remove sockets? How shall we handle rea
Jana
2015/11/17 01:50:08
We don't remove sockets at this point. This is why
| |
215 | |
216 // Call to add a new PacketReader to the session. Returns true if reader was | |
217 // successfully added to the session. Takes ownership of |reader|. | |
218 bool AddPacketReader(QuicPacketReader* reader); | |
Ryan Hamilton
2015/09/08 04:09:37
Should this be a scoped_ptr?
Jana
2015/11/17 01:50:08
Done.
| |
219 | |
Ryan Hamilton
2015/09/08 04:09:38
It's a bit odd that we need a socket, reader and w
Jana
2015/11/17 01:50:08
Fixed in the new version, PTAL.
| |
213 protected: | 220 protected: |
214 // QuicSession methods: | 221 // QuicSession methods: |
215 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 222 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
216 | 223 |
217 private: | 224 private: |
218 friend class test::QuicChromiumClientSessionPeer; | 225 friend class test::QuicChromiumClientSessionPeer; |
219 | 226 |
220 typedef std::set<Observer*> ObserverSet; | 227 typedef std::set<Observer*> ObserverSet; |
221 typedef std::list<StreamRequest*> StreamRequestQueue; | 228 typedef std::list<StreamRequest*> StreamRequestQueue; |
222 | 229 |
(...skipping 29 matching lines...) Expand all Loading... | |
252 // Notifies the factory that this session has been closed which will | 259 // Notifies the factory that this session has been closed which will |
253 // delete |this|. | 260 // delete |this|. |
254 void NotifyFactoryOfSessionClosed(); | 261 void NotifyFactoryOfSessionClosed(); |
255 | 262 |
256 void OnConnectTimeout(); | 263 void OnConnectTimeout(); |
257 | 264 |
258 QuicServerId server_id_; | 265 QuicServerId server_id_; |
259 bool require_confirmation_; | 266 bool require_confirmation_; |
260 scoped_ptr<QuicCryptoClientStream> crypto_stream_; | 267 scoped_ptr<QuicCryptoClientStream> crypto_stream_; |
261 QuicStreamFactory* stream_factory_; | 268 QuicStreamFactory* stream_factory_; |
262 scoped_ptr<DatagramClientSocket> socket_; | 269 std::vector<scoped_ptr<DatagramClientSocket>> sockets_; |
263 TransportSecurityState* transport_security_state_; | 270 TransportSecurityState* transport_security_state_; |
264 scoped_ptr<QuicServerInfo> server_info_; | 271 scoped_ptr<QuicServerInfo> server_info_; |
265 scoped_ptr<CertVerifyResult> cert_verify_result_; | 272 scoped_ptr<CertVerifyResult> cert_verify_result_; |
266 std::string pinning_failure_log_; | 273 std::string pinning_failure_log_; |
267 ObserverSet observers_; | 274 ObserverSet observers_; |
268 StreamRequestQueue stream_requests_; | 275 StreamRequestQueue stream_requests_; |
269 CompletionCallback callback_; | 276 CompletionCallback callback_; |
270 size_t num_total_streams_; | 277 size_t num_total_streams_; |
271 base::TaskRunner* task_runner_; | 278 base::TaskRunner* task_runner_; |
272 BoundNetLog net_log_; | 279 BoundNetLog net_log_; |
273 QuicPacketReader packet_reader_; | 280 std::vector<scoped_ptr<QuicPacketReader>> packet_readers_; |
274 base::TimeTicks dns_resolution_end_time_; | 281 base::TimeTicks dns_resolution_end_time_; |
275 base::TimeTicks handshake_start_; // Time the handshake was started. | 282 base::TimeTicks handshake_start_; // Time the handshake was started. |
276 scoped_ptr<QuicConnectionLogger> logger_; | 283 scoped_ptr<QuicConnectionLogger> logger_; |
277 // True when the session is going away, and streams may no longer be created | 284 // True when the session is going away, and streams may no longer be created |
278 // on this session. Existing stream will continue to be processed. | 285 // on this session. Existing stream will continue to be processed. |
279 bool going_away_; | 286 bool going_away_; |
280 QuicDisabledReason disabled_reason_; | 287 QuicDisabledReason disabled_reason_; |
281 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 288 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
282 | 289 |
283 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 290 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
284 }; | 291 }; |
285 | 292 |
286 } // namespace net | 293 } // namespace net |
287 | 294 |
288 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 295 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |