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_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 TokenBindingType tb_type, | 215 TokenBindingType tb_type, |
216 std::vector<uint8_t>* out) override; | 216 std::vector<uint8_t>* out) override; |
217 | 217 |
218 // Performs a crypto handshake with the server. | 218 // Performs a crypto handshake with the server. |
219 int CryptoConnect(const CompletionCallback& callback); | 219 int CryptoConnect(const CompletionCallback& callback); |
220 | 220 |
221 // Causes the QuicConnectionHelper to start reading from all sockets | 221 // Causes the QuicConnectionHelper to start reading from all sockets |
222 // and passing the data along to the QuicConnection. | 222 // and passing the data along to the QuicConnection. |
223 void StartReading(); | 223 void StartReading(); |
224 | 224 |
225 // Close the session because of |error| and notifies the factory | 225 // Close the session because of |error| and notifies the factory |
Zhongyi Shi
2017/04/29 21:05:19
nit: |net_error|
Ryan Hamilton
2017/05/01 02:02:05
Done.
| |
226 // that this session has been closed, which will delete the session. | 226 // that this session has been closed, which will delete the session. |
227 void CloseSessionOnError(int error, QuicErrorCode quic_error); | 227 void CloseSessionOnError(int net_error, QuicErrorCode quic_error); |
228 | 228 |
229 std::unique_ptr<base::Value> GetInfoAsValue( | 229 std::unique_ptr<base::Value> GetInfoAsValue( |
230 const std::set<HostPortPair>& aliases); | 230 const std::set<HostPortPair>& aliases); |
231 | 231 |
232 const NetLogWithSource& net_log() const { return net_log_; } | 232 const NetLogWithSource& net_log() const { return net_log_; } |
233 | 233 |
234 base::WeakPtr<QuicChromiumClientSession> GetWeakPtr(); | 234 base::WeakPtr<QuicChromiumClientSession> GetWeakPtr(); |
235 | 235 |
236 // Returns the number of client hello messages that have been sent on the | 236 // Returns the number of client hello messages that have been sent on the |
237 // crypto stream. If the handshake has completed then this is one greater | 237 // crypto stream. If the handshake has completed then this is one greater |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 typedef std::set<Observer*> ObserverSet; | 330 typedef std::set<Observer*> ObserverSet; |
331 typedef std::list<StreamRequest*> StreamRequestQueue; | 331 typedef std::list<StreamRequest*> StreamRequestQueue; |
332 | 332 |
333 QuicChromiumClientStream* CreateOutgoingReliableStreamImpl(); | 333 QuicChromiumClientStream* CreateOutgoingReliableStreamImpl(); |
334 QuicChromiumClientStream* CreateIncomingReliableStreamImpl(QuicStreamId id); | 334 QuicChromiumClientStream* CreateIncomingReliableStreamImpl(QuicStreamId id); |
335 // A completion callback invoked when a read completes. | 335 // A completion callback invoked when a read completes. |
336 void OnReadComplete(int result); | 336 void OnReadComplete(int result); |
337 | 337 |
338 void OnClosedStream(); | 338 void OnClosedStream(); |
339 | 339 |
340 // Close the session because of |error| and records it in UMA histogram. | |
341 void RecordAndCloseSessionOnError(int error, QuicErrorCode quic_error); | |
342 | |
343 // A Session may be closed via any of three methods: | |
344 // OnConnectionClosed - called by the connection when the connection has been | |
345 // closed, perhaps due to a timeout or a protocol error. | |
346 // CloseSessionOnError - called from the owner of the session, | |
347 // the QuicStreamFactory, when there is an error. | |
348 // OnReadComplete - when there is a read error. | |
349 // This method closes all stream and performs any necessary cleanup. | |
350 void CloseSessionOnErrorInner(int net_error, QuicErrorCode quic_error); | |
351 | |
352 void CloseAllStreams(int net_error); | 340 void CloseAllStreams(int net_error); |
353 void CloseAllObservers(int net_error); | 341 void CloseAllObservers(int net_error); |
354 void CancelAllRequests(int net_error); | 342 void CancelAllRequests(int net_error); |
355 | 343 |
356 // Notifies the factory that this session is going away and no more streams | 344 // Notifies the factory that this session is going away and no more streams |
357 // should be created from it. This needs to be called before closing any | 345 // should be created from it. This needs to be called before closing any |
358 // streams, because closing a stream may cause a new stream to be created. | 346 // streams, because closing a stream may cause a new stream to be created. |
359 void NotifyFactoryOfSessionGoingAway(); | 347 void NotifyFactoryOfSessionGoingAway(); |
360 | 348 |
361 // Posts a task to notify the factory that this session has been closed. | 349 // Posts a task to notify the factory that this session has been closed. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 // the current sockets_.size() == the passed in value. | 396 // the current sockets_.size() == the passed in value. |
409 bool migration_pending_; // True while migration is underway. | 397 bool migration_pending_; // True while migration is underway. |
410 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 398 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
411 | 399 |
412 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 400 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
413 }; | 401 }; |
414 | 402 |
415 } // namespace net | 403 } // namespace net |
416 | 404 |
417 #endif // NET_QUIC_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 405 #endif // NET_QUIC_CHROMIUM_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |