Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: net/quic/chromium/quic_chromium_client_session.h

Issue 2319343004: Makes migration on write error asynchronous to avoid reentrancy issues (Closed)
Patch Set: synced and rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/chromium/quic_chromium_client_session.h
diff --git a/net/quic/chromium/quic_chromium_client_session.h b/net/quic/chromium/quic_chromium_client_session.h
index b51fc440d57c5cfafe5e76936bb6f87e0088f1a7..35f0ee888a46772af09bfea390a90b869352c7bf 100644
--- a/net/quic/chromium/quic_chromium_client_session.h
+++ b/net/quic/chromium/quic_chromium_client_session.h
@@ -253,19 +253,25 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
QuicDisabledReason disabled_reason() const { return disabled_reason_; }
+ // Attempts to migrate session when a write error is encountered.
+ void MigrateSessionOnWriteError();
+
+ // Helper method that writes a packet on the new socket after
+ // migration completes. If not null, the packet_ member is written,
+ // otherwise a PING packet is written.
+ void WriteToNewSocket();
+
// Migrates session onto new socket, i.e., starts reading from
// |socket| in addition to any previous sockets, and sets |writer|
// to be the new default writer. Returns true if socket was
// successfully added to the session and the session was
- // successfully migrated to using the new socket. If not null,
- // |packet| is sent on the new network, else a PING frame is
- // sent. Returns true on successful migration, or false if number of
- // migrations exceeds kMaxReadersPerQuicSession. Takes ownership of
- // |socket|, |reader|, and |writer|.
+ // successfully migrated to using the new socket. Returns true on
+ // successful migration, or false if number of migrations exceeds
+ // kMaxReadersPerQuicSession. Takes ownership of |socket|, |reader|,
+ // and |writer|.
bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket,
std::unique_ptr<QuicChromiumPacketReader> reader,
- std::unique_ptr<QuicChromiumPacketWriter> writer,
- scoped_refptr<StringIOBuffer> packet);
+ std::unique_ptr<QuicChromiumPacketWriter> writer);
// Populates network error details for this session.
void PopulateNetErrorDetails(NetErrorDetails* details);
@@ -365,10 +371,14 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
// UMA histogram counters for streams pushed to this session.
int streams_pushed_count_;
int streams_pushed_and_claimed_count_;
- // Return value from packet rewrite packet on new socket. Used
- // during connection migration on socket write error.
- int error_code_from_rewrite_;
- bool use_error_code_from_rewrite_;
+ // Stores packet that witnesses socket write error. This packet is
+ // written to a new socket after migration completes.
+ scoped_refptr<StringIOBuffer> packet_;
+ // TODO(jri): Replace use of migration_pending_ sockets_.size().
+ // When a task is posted for MigrateSessionOnError, pass in
+ // sockets_.size(). Then in MigrateSessionOnError, check to see if
+ // the current sockets_.size() == the passed in value.
+ bool migration_pending_; // True while migration is underway.
base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);
« no previous file with comments | « net/quic/chromium/mock_network_change_notifier.cc ('k') | net/quic/chromium/quic_chromium_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698