Commit accd8c6c authored by Shane Fitzpatrick's avatar Shane Fitzpatrick Committed by Chromium LUCI CQ

[Nearby] Replace usages of ShareTarget's "device_name" to "id" in log

calls.  Instances found by searching for references to that field

Fixed: 1162476
Change-Id: If64e74dd79e7c17859c3a7699e34abc497f9cc36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613358
Commit-Queue: Shane Fitzpatrick <shanefitz@google.com>
Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841131}
parent 38b66c1c
...@@ -979,8 +979,7 @@ void NearbySharingServiceImpl::OnEnabledChanged(bool enabled) { ...@@ -979,8 +979,7 @@ void NearbySharingServiceImpl::OnEnabledChanged(bool enabled) {
void NearbySharingServiceImpl::OnDeviceNameChanged( void NearbySharingServiceImpl::OnDeviceNameChanged(
const std::string& device_name) { const std::string& device_name) {
NS_LOG(VERBOSE) << __func__ << ": Nearby sharing device name changed to " NS_LOG(VERBOSE) << __func__ << ": Nearby sharing device name changed";
<< device_name;
// TODO(vecore): handle device name change // TODO(vecore): handle device name change
} }
...@@ -1689,8 +1688,9 @@ void NearbySharingServiceImpl::InvalidateAdvertisingState() { ...@@ -1689,8 +1688,9 @@ void NearbySharingServiceImpl::InvalidateAdvertisingState() {
<< ": StartAdvertising requested over Nearby Connections: " << ": StartAdvertising requested over Nearby Connections: "
<< " power level: " << PowerLevelToString(power_level) << " power level: " << PowerLevelToString(power_level)
<< " visibility: " << settings_.GetVisibility() << " visibility: " << settings_.GetVisibility()
<< " data usage: " << data_usage << " device name: " << " data usage: " << data_usage
<< device_name.value_or("** no device name **"); << " advertise device name?: "
<< (device_name.has_value() ? "yes" : "no");
ScheduleRotateBackgroundAdvertisementTimer(); ScheduleRotateBackgroundAdvertisementTimer();
} }
...@@ -1920,7 +1920,7 @@ void NearbySharingServiceImpl::ReceivePayloads( ...@@ -1920,7 +1920,7 @@ void NearbySharingServiceImpl::ReceivePayloads(
NearbySharingService::StatusCodes NearbySharingServiceImpl::SendPayloads( NearbySharingService::StatusCodes NearbySharingServiceImpl::SendPayloads(
const ShareTarget& share_target) { const ShareTarget& share_target) {
NS_LOG(VERBOSE) << __func__ << ": Preparing to send payloads to " NS_LOG(VERBOSE) << __func__ << ": Preparing to send payloads to "
<< share_target.device_name; << share_target.id;
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection()) { if (!info || !info->connection()) {
NS_LOG(WARNING) << "Failed to send payload due to missing connection."; NS_LOG(WARNING) << "Failed to send payload due to missing connection.";
...@@ -2027,7 +2027,7 @@ void NearbySharingServiceImpl::OnPayloadPathsRegistered( ...@@ -2027,7 +2027,7 @@ void NearbySharingServiceImpl::OnPayloadPathsRegistered(
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Accepted incoming files from share target - " << ": Accepted incoming files from share target - "
<< share_target.device_name; << share_target.id;
} }
WriteResponse(*connection, sharing::nearby::ConnectionResponseFrame::ACCEPT); WriteResponse(*connection, sharing::nearby::ConnectionResponseFrame::ACCEPT);
...@@ -2047,7 +2047,7 @@ void NearbySharingServiceImpl::OnPayloadPathsRegistered( ...@@ -2047,7 +2047,7 @@ void NearbySharingServiceImpl::OnPayloadPathsRegistered(
NS_LOG(WARNING) << __func__ NS_LOG(WARNING) << __func__
<< ": Failed to initiate bandwidth upgrade. No endpoint_id " << ": Failed to initiate bandwidth upgrade. No endpoint_id "
"found for target - " "found for target - "
<< share_target.device_name; << share_target.id;
std::move(status_codes_callback).Run(StatusCodes::kOutOfOrderApiCall); std::move(status_codes_callback).Run(StatusCodes::kOutOfOrderApiCall);
return; return;
} }
...@@ -2069,7 +2069,7 @@ void NearbySharingServiceImpl::OnOutgoingConnection( ...@@ -2069,7 +2069,7 @@ void NearbySharingServiceImpl::OnOutgoingConnection(
if (!success) { if (!success) {
NS_LOG(WARNING) << __func__ NS_LOG(WARNING) << __func__
<< ": Failed to initate connection to share target " << ": Failed to initate connection to share target "
<< share_target.device_name; << share_target.id;
if (info && info->transfer_update_callback()) { if (info && info->transfer_update_callback()) {
info->transfer_update_callback()->OnTransferUpdate( info->transfer_update_callback()->OnTransferUpdate(
share_target, TransferMetadataBuilder() share_target, TransferMetadataBuilder()
...@@ -2105,12 +2105,12 @@ void NearbySharingServiceImpl::SendIntroduction( ...@@ -2105,12 +2105,12 @@ void NearbySharingServiceImpl::SendIntroduction(
// IDs in our our introduction frame so that they know what to expect if they // IDs in our our introduction frame so that they know what to expect if they
// accept. // accept.
NS_LOG(VERBOSE) << __func__ << ": Preparing to send introduction to " NS_LOG(VERBOSE) << __func__ << ": Preparing to send introduction to "
<< share_target.device_name; << share_target.id;
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection()) { if (!info || !info->connection()) {
NS_LOG(WARNING) << __func__ << ": No NearbyConnection tied to " NS_LOG(WARNING) << __func__ << ": No NearbyConnection tied to "
<< share_target.device_name; << share_target.id;
return; return;
} }
NearbyConnection* connection = info->connection(); NearbyConnection* connection = info->connection();
...@@ -2131,8 +2131,7 @@ void NearbySharingServiceImpl::SendIntroduction( ...@@ -2131,8 +2131,7 @@ void NearbySharingServiceImpl::SendIntroduction(
// Build the introduction. // Build the introduction.
auto introduction = std::make_unique<sharing::nearby::IntroductionFrame>(); auto introduction = std::make_unique<sharing::nearby::IntroductionFrame>();
NS_LOG(VERBOSE) << __func__ << ": Sending attachments to " NS_LOG(VERBOSE) << __func__ << ": Sending attachments to " << share_target.id;
<< share_target.device_name;
// Write introduction of file payloads. // Write introduction of file payloads.
for (const auto& file : share_target.file_attachments) { for (const auto& file : share_target.file_attachments) {
...@@ -2536,7 +2535,7 @@ void NearbySharingServiceImpl::CloseConnection( ...@@ -2536,7 +2535,7 @@ void NearbySharingServiceImpl::CloseConnection(
NearbyConnection* connection = GetConnection(share_target); NearbyConnection* connection = GetConnection(share_target);
if (!connection) { if (!connection) {
NS_LOG(WARNING) << __func__ << ": Invalid connection for target - " NS_LOG(WARNING) << __func__ << ": Invalid connection for target - "
<< share_target.device_name; << share_target.id;
return; return;
} }
connection->Close(); connection->Close();
...@@ -2570,7 +2569,7 @@ void NearbySharingServiceImpl::OnIncomingDecryptedCertificate( ...@@ -2570,7 +2569,7 @@ void NearbySharingServiceImpl::OnIncomingDecryptedCertificate(
} }
NS_LOG(VERBOSE) << __func__ << "Received incoming connection from " NS_LOG(VERBOSE) << __func__ << "Received incoming connection from "
<< share_target->device_name; << share_target->id;
ShareTargetInfo* share_target_info = GetShareTargetInfo(*share_target); ShareTargetInfo* share_target_info = GetShareTargetInfo(*share_target);
DCHECK(share_target_info); DCHECK(share_target_info);
...@@ -2644,14 +2643,14 @@ void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone( ...@@ -2644,14 +2643,14 @@ void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone(
switch (result) { switch (result) {
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kFail: case PairedKeyVerificationRunner::PairedKeyVerificationResult::kFail:
NS_LOG(VERBOSE) << __func__ << ": Paired key handshake failed for target " NS_LOG(VERBOSE) << __func__ << ": Paired key handshake failed for target "
<< share_target.device_name << ". Disconnecting."; << share_target.id << ". Disconnecting.";
info->connection()->Close(); info->connection()->Close();
return; return;
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kSuccess: case PairedKeyVerificationRunner::PairedKeyVerificationResult::kSuccess:
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Paired key handshake succeeded for target - " << ": Paired key handshake succeeded for target - "
<< share_target.device_name; << share_target.id;
nearby_connections_manager_->UpgradeBandwidth(*info->endpoint_id()); nearby_connections_manager_->UpgradeBandwidth(*info->endpoint_id());
ReceiveIntroduction(share_target, /*four_digit_token=*/base::nullopt); ReceiveIntroduction(share_target, /*four_digit_token=*/base::nullopt);
break; break;
...@@ -2660,7 +2659,7 @@ void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone( ...@@ -2660,7 +2659,7 @@ void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone(
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Unable to verify paired key encryption when " << ": Unable to verify paired key encryption when "
"receiving connection from target - " "receiving connection from target - "
<< share_target.device_name; << share_target.id;
if (advertising_power_level_ == PowerLevel::kHighPower) if (advertising_power_level_ == PowerLevel::kHighPower)
nearby_connections_manager_->UpgradeBandwidth(*info->endpoint_id()); nearby_connections_manager_->UpgradeBandwidth(*info->endpoint_id());
...@@ -2673,7 +2672,7 @@ void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone( ...@@ -2673,7 +2672,7 @@ void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone(
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kUnknown: case PairedKeyVerificationRunner::PairedKeyVerificationResult::kUnknown:
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Unknown PairedKeyVerificationResult for target " << ": Unknown PairedKeyVerificationResult for target "
<< share_target.device_name << ". Disconnecting."; << share_target.id << ". Disconnecting.";
info->connection()->Close(); info->connection()->Close();
break; break;
} }
...@@ -2701,7 +2700,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone( ...@@ -2701,7 +2700,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone(
switch (result) { switch (result) {
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kFail: case PairedKeyVerificationRunner::PairedKeyVerificationResult::kFail:
NS_LOG(VERBOSE) << __func__ << ": Paired key handshake failed for target " NS_LOG(VERBOSE) << __func__ << ": Paired key handshake failed for target "
<< share_target.device_name << ". Disconnecting."; << share_target.id << ". Disconnecting.";
info->transfer_update_callback()->OnTransferUpdate( info->transfer_update_callback()->OnTransferUpdate(
share_target, TransferMetadataBuilder() share_target, TransferMetadataBuilder()
.set_status(TransferMetadata::Status::kFailed) .set_status(TransferMetadata::Status::kFailed)
...@@ -2712,7 +2711,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone( ...@@ -2712,7 +2711,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone(
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kSuccess: case PairedKeyVerificationRunner::PairedKeyVerificationResult::kSuccess:
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Paired key handshake succeeded for target - " << ": Paired key handshake succeeded for target - "
<< share_target.device_name; << share_target.id;
SendIntroduction(share_target, /*four_digit_token=*/base::nullopt); SendIntroduction(share_target, /*four_digit_token=*/base::nullopt);
SendPayloads(share_target); SendPayloads(share_target);
return; return;
...@@ -2721,7 +2720,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone( ...@@ -2721,7 +2720,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone(
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Unable to verify paired key encryption when " << ": Unable to verify paired key encryption when "
"initating connection to target - " "initating connection to target - "
<< share_target.device_name; << share_target.id;
if (four_digit_token) if (four_digit_token)
info->set_token(*four_digit_token); info->set_token(*four_digit_token);
...@@ -2730,7 +2729,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone( ...@@ -2730,7 +2729,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone(
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Sender-side verification is disabled. Skipping " << ": Sender-side verification is disabled. Skipping "
"token comparison with " "token comparison with "
<< share_target.device_name; << share_target.id;
SendIntroduction(share_target, /*four_digit_token=*/base::nullopt); SendIntroduction(share_target, /*four_digit_token=*/base::nullopt);
SendPayloads(share_target); SendPayloads(share_target);
} else { } else {
...@@ -2741,7 +2740,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone( ...@@ -2741,7 +2740,7 @@ void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone(
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kUnknown: case PairedKeyVerificationRunner::PairedKeyVerificationResult::kUnknown:
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": Unknown PairedKeyVerificationResult for target " << ": Unknown PairedKeyVerificationResult for target "
<< share_target.device_name << ". Disconnecting."; << share_target.id << ". Disconnecting.";
info->connection()->Close(); info->connection()->Close();
break; break;
} }
...@@ -2766,7 +2765,7 @@ void NearbySharingServiceImpl::ReceiveIntroduction( ...@@ -2766,7 +2765,7 @@ void NearbySharingServiceImpl::ReceiveIntroduction(
ShareTarget share_target, ShareTarget share_target,
base::Optional<std::string> four_digit_token) { base::Optional<std::string> four_digit_token) {
NS_LOG(INFO) << __func__ << ": Receiving introduction from " NS_LOG(INFO) << __func__ << ": Receiving introduction from "
<< share_target.device_name; << share_target.id;
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
DCHECK(info && info->connection()); DCHECK(info && info->connection());
...@@ -2857,7 +2856,7 @@ void NearbySharingServiceImpl::OnReceivedIntroduction( ...@@ -2857,7 +2856,7 @@ void NearbySharingServiceImpl::OnReceivedIntroduction(
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": We don't support the attachments sent by the sender. " << ": We don't support the attachments sent by the sender. "
"We have informed " "We have informed "
<< share_target.device_name; << share_target.id;
return; return;
} }
...@@ -2885,7 +2884,7 @@ void NearbySharingServiceImpl::OnReceivedIntroduction( ...@@ -2885,7 +2884,7 @@ void NearbySharingServiceImpl::OnReceivedIntroduction(
void NearbySharingServiceImpl::ReceiveConnectionResponse( void NearbySharingServiceImpl::ReceiveConnectionResponse(
ShareTarget share_target) { ShareTarget share_target) {
NS_LOG(VERBOSE) << __func__ << ": Receiving response frame from " NS_LOG(VERBOSE) << __func__ << ": Receiving response frame from "
<< share_target.device_name; << share_target.id;
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
DCHECK(info && info->connection()); DCHECK(info && info->connection());
...@@ -3033,14 +3032,14 @@ void NearbySharingServiceImpl::OnStorageCheckCompleted( ...@@ -3033,14 +3032,14 @@ void NearbySharingServiceImpl::OnStorageCheckCompleted(
Fail(share_target, TransferMetadata::Status::kNotEnoughSpace); Fail(share_target, TransferMetadata::Status::kNotEnoughSpace);
NS_LOG(WARNING) << __func__ NS_LOG(WARNING) << __func__
<< ": Not enough space on the receiver. We have informed " << ": Not enough space on the receiver. We have informed "
<< share_target.device_name; << share_target.id;
return; return;
} }
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection()) { if (!info || !info->connection()) {
NS_LOG(WARNING) << __func__ << ": Invalid connection for share target - " NS_LOG(WARNING) << __func__ << ": Invalid connection for share target - "
<< share_target.device_name; << share_target.id;
return; return;
} }
NearbyConnection* connection = info->connection(); NearbyConnection* connection = info->connection();
...@@ -3071,7 +3070,7 @@ void NearbySharingServiceImpl::OnStorageCheckCompleted( ...@@ -3071,7 +3070,7 @@ void NearbySharingServiceImpl::OnStorageCheckCompleted(
connection->Close(); connection->Close();
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": IncomingShareTarget not found, disconnecting " << ": IncomingShareTarget not found, disconnecting "
<< share_target.device_name; << share_target.id;
return; return;
} }
...@@ -3174,7 +3173,7 @@ void NearbySharingServiceImpl::OnIncomingMutualAcceptanceTimeout( ...@@ -3174,7 +3173,7 @@ void NearbySharingServiceImpl::OnIncomingMutualAcceptanceTimeout(
NS_LOG(VERBOSE) NS_LOG(VERBOSE)
<< __func__ << __func__
<< ": Incoming mutual acceptance timed out, closing connection for " << ": Incoming mutual acceptance timed out, closing connection for "
<< share_target.device_name; << share_target.id;
Fail(share_target, TransferMetadata::Status::kTimedOut); Fail(share_target, TransferMetadata::Status::kTimedOut);
} }
...@@ -3186,7 +3185,7 @@ void NearbySharingServiceImpl::OnOutgoingMutualAcceptanceTimeout( ...@@ -3186,7 +3185,7 @@ void NearbySharingServiceImpl::OnOutgoingMutualAcceptanceTimeout(
NS_LOG(VERBOSE) NS_LOG(VERBOSE)
<< __func__ << __func__
<< ": Outgoing mutual acceptance timed out, closing connection for " << ": Outgoing mutual acceptance timed out, closing connection for "
<< share_target.device_name; << share_target.id;
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info) if (!info)
...@@ -3296,7 +3295,7 @@ bool NearbySharingServiceImpl::OnIncomingPayloadsComplete( ...@@ -3296,7 +3295,7 @@ bool NearbySharingServiceImpl::OnIncomingPayloadsComplete(
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection()) { if (!info || !info->connection()) {
NS_LOG(VERBOSE) << __func__ << ": Connection not found for target - " NS_LOG(VERBOSE) << __func__ << ": Connection not found for target - "
<< share_target.device_name; << share_target.id;
return false; return false;
} }
...@@ -3389,7 +3388,7 @@ void NearbySharingServiceImpl::Disconnect(const ShareTarget& share_target, ...@@ -3389,7 +3388,7 @@ void NearbySharingServiceImpl::Disconnect(const ShareTarget& share_target,
NS_LOG(WARNING) NS_LOG(WARNING)
<< __func__ << __func__
<< ": Failed to disconnect. No share target info found for target - " << ": Failed to disconnect. No share target info found for target - "
<< share_target.device_name; << share_target.id;
return; return;
} }
...@@ -3398,7 +3397,7 @@ void NearbySharingServiceImpl::Disconnect(const ShareTarget& share_target, ...@@ -3398,7 +3397,7 @@ void NearbySharingServiceImpl::Disconnect(const ShareTarget& share_target,
NS_LOG(WARNING) NS_LOG(WARNING)
<< __func__ << __func__
<< ": Failed to disconnect. No endpoint id found for share target - " << ": Failed to disconnect. No endpoint id found for share target - "
<< share_target.device_name; << share_target.id;
return; return;
} }
...@@ -3561,7 +3560,7 @@ base::Optional<int64_t> NearbySharingServiceImpl::GetAttachmentPayloadId( ...@@ -3561,7 +3560,7 @@ base::Optional<int64_t> NearbySharingServiceImpl::GetAttachmentPayloadId(
void NearbySharingServiceImpl::UnregisterShareTarget( void NearbySharingServiceImpl::UnregisterShareTarget(
const ShareTarget& share_target) { const ShareTarget& share_target) {
NS_LOG(VERBOSE) << __func__ << ": Unregistering share target - " NS_LOG(VERBOSE) << __func__ << ": Unregistering share target - "
<< share_target.device_name; << share_target.id;
// For metrics. // For metrics.
cancelled_share_target_ids_.erase(share_target.id); cancelled_share_target_ids_.erase(share_target.id);
...@@ -3590,8 +3589,8 @@ void NearbySharingServiceImpl::UnregisterShareTarget( ...@@ -3590,8 +3589,8 @@ void NearbySharingServiceImpl::UnregisterShareTarget(
// share_target/endpoint_id for next time. // share_target/endpoint_id for next time.
ClearOutgoingShareTargetInfoMap(); ClearOutgoingShareTargetInfoMap();
NS_LOG(VERBOSE) << __func__ << ": Unregister share target: " NS_LOG(VERBOSE) << __func__
<< share_target.device_name; << ": Unregister share target: " << share_target.id;
} }
mutual_acceptance_timeout_alarm_.Cancel(); mutual_acceptance_timeout_alarm_.Cancel();
} }
......
...@@ -123,7 +123,7 @@ void PairedKeyVerificationRunner::OnReadPairedKeyEncryptionFrame( ...@@ -123,7 +123,7 @@ void PairedKeyVerificationRunner::OnReadPairedKeyEncryptionFrame(
NS_LOG(VERBOSE) << __func__ NS_LOG(VERBOSE) << __func__
<< ": we are only allowing connections with contacts. " << ": we are only allowing connections with contacts. "
"Rejecting connection from unknown ShareTarget - " "Rejecting connection from unknown ShareTarget - "
<< share_target_.device_name; << share_target_.id;
std::move(callback_).Run(PairedKeyVerificationResult::kFail); std::move(callback_).Run(PairedKeyVerificationResult::kFail);
return; return;
} }
......
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