Commit ef52e20a authored by Zhongyi Shi's avatar Zhongyi Shi Committed by Commit Bot

Add a label in URLRequest NetLog to indicate the connection migration mode

it is running with.

QUIC Connection Migration: add a label in each URLRequest to indicate
connection migration mode it's running with so that URLRequest and associated
QuicSession can be differentiated in a single NetLog if multiple CronetEngines
with different experiment configurations are running at the same time.

Bug: 774622
Change-Id: I003f0ac83efbec7ac41d16a83ef5d0230d4aa7d1
Reviewed-on: https://chromium-review.googlesource.com/804296Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521210}
parent da41776e
...@@ -2005,7 +2005,11 @@ EVENT_TYPE(QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS) ...@@ -2005,7 +2005,11 @@ EVENT_TYPE(QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// QuicConnectionMigration // QuicConnectionMigration
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Records the QUIC connection migration mode.
// {
// "connection_migration_mode": <The connection migration mode>
// }
EVENT_TYPE(QUIC_CONNECTION_MIGRATION_MODE)
// Records that QUIC connection migration has been triggered. // Records that QUIC connection migration has been triggered.
// { // {
// "trigger": <The reason for the migration attempt> // "trigger": <The reason for the migration attempt>
......
...@@ -891,6 +891,25 @@ void QuicChromiumClientSession::RemoveHandle(Handle* handle) { ...@@ -891,6 +891,25 @@ void QuicChromiumClientSession::RemoveHandle(Handle* handle) {
handles_.erase(handle); handles_.erase(handle);
} }
// TODO(zhongyi): replace migration_session_* booleans with
// ConnectionMigrationMode.
ConnectionMigrationMode QuicChromiumClientSession::connection_migration_mode()
const {
if (migrate_session_early_v2_)
return ConnectionMigrationMode::FULL_MIGRATION_V2;
if (migrate_session_on_network_change_v2_)
return ConnectionMigrationMode::NO_MIGRATION_ON_PATH_DEGRADING_V2;
if (migrate_session_early_)
return ConnectionMigrationMode::FULL_MIGRATION_V1;
if (migrate_session_on_network_change_)
return ConnectionMigrationMode::NO_MIGRATION_ON_PATH_DEGRADING_V1;
return ConnectionMigrationMode::NO_MIGRATION;
}
int QuicChromiumClientSession::WaitForHandshakeConfirmation( int QuicChromiumClientSession::WaitForHandshakeConfirmation(
const CompletionCallback& callback) { const CompletionCallback& callback) {
if (!connection()->connected()) if (!connection()->connected())
......
...@@ -69,6 +69,15 @@ enum class MigrationResult { ...@@ -69,6 +69,15 @@ enum class MigrationResult {
FAILURE // Migration failed for other reasons. FAILURE // Migration failed for other reasons.
}; };
// Mode of connection migration.
enum class ConnectionMigrationMode {
NO_MIGRATION,
NO_MIGRATION_ON_PATH_DEGRADING_V1,
FULL_MIGRATION_V1,
NO_MIGRATION_ON_PATH_DEGRADING_V2,
FULL_MIGRATION_V2
};
// Result of a connectivity probing attempt. // Result of a connectivity probing attempt.
enum class ProbingResult { enum class ProbingResult {
PENDING, // Probing started, pending result. PENDING, // Probing started, pending result.
...@@ -172,6 +181,11 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession ...@@ -172,6 +181,11 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
// Returns the session's net log. // Returns the session's net log.
const NetLogWithSource& net_log() const { return net_log_; } const NetLogWithSource& net_log() const { return net_log_; }
// Returns the session's connection migration mode.
ConnectionMigrationMode connection_migration_mode() const {
return session_->connection_migration_mode();
}
// QuicClientPushPromiseIndex::Delegate implementation // QuicClientPushPromiseIndex::Delegate implementation
bool CheckVary(const SpdyHeaderBlock& client_request, bool CheckVary(const SpdyHeaderBlock& client_request,
const SpdyHeaderBlock& promise_request, const SpdyHeaderBlock& promise_request,
...@@ -338,6 +352,9 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession ...@@ -338,6 +352,9 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
void AddHandle(Handle* handle); void AddHandle(Handle* handle);
void RemoveHandle(Handle* handle); void RemoveHandle(Handle* handle);
// Returns the session's connection migration mode.
ConnectionMigrationMode connection_migration_mode() const;
// Waits for the handshake to be confirmed and invokes |callback| when // Waits for the handshake to be confirmed and invokes |callback| when
// that happens. If the handshake has already been confirmed, returns OK. // that happens. If the handshake has already been confirmed, returns OK.
// If the connection has already been closed, returns a net error. If the // If the connection has already been closed, returns a net error. If the
......
...@@ -114,6 +114,11 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info, ...@@ -114,6 +114,11 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
stream_net_log.AddEvent( stream_net_log.AddEvent(
NetLogEventType::HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION, NetLogEventType::HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION,
quic_session()->net_log().source().ToEventParametersCallback()); quic_session()->net_log().source().ToEventParametersCallback());
stream_net_log.AddEvent(
NetLogEventType::QUIC_CONNECTION_MIGRATION_MODE,
NetLog::IntCallback(
"connection_migration_mode",
static_cast<int>(quic_session()->connection_migration_mode())));
stream_net_log_ = stream_net_log; stream_net_log_ = stream_net_log;
request_info_ = request_info; request_info_ = request_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment