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, |