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

Unified Diff: net/quic/quic_stream_factory.cc

Issue 2124753005: Implements migration of a QUIC connection to a different destination address if specified by the se… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write-error
Patch Set: Comments addressed. Created 4 years, 5 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/quic_stream_factory.cc
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 2890f63bb0f608637a0a3b801703d9ad08fc22a1..0df8509c26525bfbee75756b566944c5945ca253 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -1443,7 +1443,7 @@ void QuicStreamFactory::MaybeMigrateOrCloseSessions(
continue;
}
- MigrateSessionToNetwork(session, new_network, bound_net_log, nullptr);
+ MigrateSessionToNewNetwork(session, new_network, bound_net_log, nullptr);
}
}
@@ -1475,15 +1475,36 @@ void QuicStreamFactory::MaybeMigrateSingleSession(
return;
}
OnSessionGoingAway(session);
- MigrateSessionToNetwork(session, new_network, scoped_event_log.net_log(),
- packet);
+ MigrateSessionToNewNetwork(session, new_network, scoped_event_log.net_log(),
+ packet);
}
-void QuicStreamFactory::MigrateSessionToNetwork(
+void QuicStreamFactory::MigrateSessionToNewPeerAddress(
QuicChromiumClientSession* session,
- NetworkHandle new_network,
+ IPEndPoint peer_address,
const BoundNetLog& bound_net_log,
scoped_refptr<StringIOBuffer> packet) {
+ // Specifying kInvalidNetworkHandle for the |network| parameter
+ // causes the session to use the default network for the new socket.
+ MigrateSession(session, peer_address,
+ NetworkChangeNotifier::kInvalidNetworkHandle, bound_net_log,
+ packet);
+}
+
+void QuicStreamFactory::MigrateSessionToNewNetwork(
+ QuicChromiumClientSession* session,
+ NetworkHandle network,
+ const BoundNetLog& bound_net_log,
+ scoped_refptr<StringIOBuffer> packet) {
+ MigrateSession(session, session->connection()->peer_address(), network,
+ bound_net_log, packet);
+}
+
+void QuicStreamFactory::MigrateSession(QuicChromiumClientSession* session,
+ IPEndPoint peer_address,
+ NetworkHandle network,
+ const BoundNetLog& bound_net_log,
+ scoped_refptr<StringIOBuffer> packet) {
// Use OS-specified port for socket (DEFAULT_BIND) instead of
// using the PortSuggester since the connection is being migrated
// and not being newly created.
@@ -1491,9 +1512,7 @@ void QuicStreamFactory::MigrateSessionToNetwork(
client_socket_factory_->CreateDatagramClientSocket(
DatagramSocket::DEFAULT_BIND, RandIntCallback(),
session->net_log().net_log(), session->net_log().source()));
- QuicConnection* connection = session->connection();
- if (ConfigureSocket(socket.get(), connection->peer_address(), new_network) !=
- OK) {
+ if (ConfigureSocket(socket.get(), peer_address, network) != OK) {
session->CloseSessionOnError(ERR_NETWORK_CHANGED, QUIC_INTERNAL_ERROR);
HistogramAndLogMigrationFailure(
bound_net_log, MIGRATION_STATUS_INTERNAL_ERROR,

Powered by Google App Engine
This is Rietveld 408576698