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

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: Cleaning up. 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..69b1ae8ce4cf21143d6d6d1f068afd92b7c92d66 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, |packet| is written, else
+ // a PING packet is written.
+ void WriteToNewSocket(scoped_refptr<StringIOBuffer> packet);
+
// 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,8 @@ 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 for rewrite after migration due to socket write error.
+ scoped_refptr<StringIOBuffer> packet_;
base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);

Powered by Google App Engine
This is Rietveld 408576698