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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // to be the new default writer. Returns true if socket was | 266 // to be the new default writer. Returns true if socket was |
267 // successfully added to the session and the session was | 267 // successfully added to the session and the session was |
268 // successfully migrated to using the new socket. Returns true on | 268 // successfully migrated to using the new socket. Returns true on |
269 // successful migration, or false if number of migrations exceeds | 269 // successful migration, or false if number of migrations exceeds |
270 // kMaxReadersPerQuicSession. Takes ownership of |socket|, |reader|, | 270 // kMaxReadersPerQuicSession. Takes ownership of |socket|, |reader|, |
271 // and |writer|. | 271 // and |writer|. |
272 bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket, | 272 bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket, |
273 std::unique_ptr<QuicChromiumPacketReader> reader, | 273 std::unique_ptr<QuicChromiumPacketReader> reader, |
274 std::unique_ptr<QuicChromiumPacketWriter> writer); | 274 std::unique_ptr<QuicChromiumPacketWriter> writer); |
275 | 275 |
| 276 // Method to call when NetworkChangeNotifier notifies observers of a |
| 277 // new network. Tries to migrate any sessions that are waiting for a |
| 278 // new network to connect. |
| 279 void OnNetworkConnected(NetworkChangeNotifier::NetworkHandle network, |
| 280 const BoundNetLog& bound_net_log); |
| 281 |
| 282 // Schedules a migration alarm if one isn't already pending to wait |
| 283 // for a new network. |
| 284 void OnNoNewNetwork(); |
| 285 |
| 286 // If migration alarm was not cancelled, closes session with error. |
| 287 void OnMigrationTimeout(); |
| 288 |
276 // Populates network error details for this session. | 289 // Populates network error details for this session. |
277 void PopulateNetErrorDetails(NetErrorDetails* details); | 290 void PopulateNetErrorDetails(NetErrorDetails* details); |
278 | 291 |
279 // Returns current default socket. This is the socket over which all | 292 // Returns current default socket. This is the socket over which all |
280 // QUIC packets are sent. This default socket can change, so do not store the | 293 // QUIC packets are sent. This default socket can change, so do not store the |
281 // returned socket. | 294 // returned socket. |
282 const DatagramClientSocket* GetDefaultSocket() const; | 295 const DatagramClientSocket* GetDefaultSocket() const; |
283 | 296 |
284 bool IsAuthorized(const std::string& hostname) override; | 297 bool IsAuthorized(const std::string& hostname) override; |
285 | 298 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 QuicDisabledReason disabled_reason_; | 382 QuicDisabledReason disabled_reason_; |
370 TokenBindingSignatureMap token_binding_signatures_; | 383 TokenBindingSignatureMap token_binding_signatures_; |
371 // UMA histogram counters for streams pushed to this session. | 384 // UMA histogram counters for streams pushed to this session. |
372 int streams_pushed_count_; | 385 int streams_pushed_count_; |
373 int streams_pushed_and_claimed_count_; | 386 int streams_pushed_and_claimed_count_; |
374 // Stores packet that witnesses socket write error. This packet is | 387 // Stores packet that witnesses socket write error. This packet is |
375 // written to a new socket after migration completes. | 388 // written to a new socket after migration completes. |
376 scoped_refptr<StringIOBuffer> packet_; | 389 scoped_refptr<StringIOBuffer> packet_; |
377 bool migration_pending_; // True while migration is underway. | 390 bool migration_pending_; // True while migration is underway. |
378 bool write_pending_; // True while post-migration write is underway. | 391 bool write_pending_; // True while post-migration write is underway. |
| 392 bool migration_alarm_pending_; // True when migration alarm is armed. |
379 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 393 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
380 | 394 |
381 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 395 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
382 }; | 396 }; |
383 | 397 |
384 } // namespace net | 398 } // namespace net |
385 | 399 |
386 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 400 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |