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

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: added tests for async write before notification and fixed call to OnCanWrite 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..d3eb0fd83f260753c00f7eb2017e6414bcb6a9e3 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,
+ // else a PING packet is written.
Ryan Hamilton 2016/09/12 00:52:18 nit: s/else/otherwise/
Jana 2016/09/12 21:08:02 Done.
+ 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,11 @@ 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_;
+ bool migration_pending_; // True while migration is underway.
+ bool write_pending_; // True while post-migration write is underway.
base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);

Powered by Google App Engine
This is Rietveld 408576698