From 3f93c0ee876416b0a177f78542aa9580fbcc6509 Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Thu, 21 Aug 2025 12:02:26 -0700 Subject: [PATCH] Remove more unnecessary INFO logs. PiperOrigin-RevId: 797859361 --- .../analytics/throughput_recorder.cc | 27 +- .../implementation/base_pcp_handler.cc | 2 +- connections/implementation/client_proxy.cc | 20 +- connections/implementation/mediums/ble_v2.cc | 4 +- .../offline_service_controller.cc | 16 +- .../implementation/p2p_cluster_pcp_handler.cc | 186 ++++++------- connections/implementation/payload_manager.cc | 259 +++++++++--------- .../platform/implementation/windows/ble_v2.cc | 27 +- .../windows/ble_v2_server_socket.cc | 4 +- .../windows/bluetooth_adapter.cc | 31 ++- .../windows/bluetooth_classic_medium.cc | 18 +- .../bluetooth_classic_server_socket.cc | 10 +- .../windows/nearby_server_socket.cc | 8 +- .../windows/wifi_hotspot_medium.cc | 28 +- .../windows/wifi_hotspot_native.cc | 4 +- .../windows/wifi_hotspot_server_socket.cc | 28 +- .../implementation/windows/wifi_lan_mdns.cc | 2 +- .../implementation/windows/wifi_lan_medium.cc | 9 +- .../implementation/windows/wifi_lan_socket.cc | 8 +- sharing/incoming_frames_reader.cc | 2 +- sharing/nearby_connections_manager_impl.cc | 58 ++-- sharing/nearby_sharing_service_impl.cc | 4 +- 22 files changed, 365 insertions(+), 390 deletions(-) diff --git a/connections/implementation/analytics/throughput_recorder.cc b/connections/implementation/analytics/throughput_recorder.cc index 6a006554..7833d4ad 100644 --- a/connections/implementation/analytics/throughput_recorder.cc +++ b/connections/implementation/analytics/throughput_recorder.cc @@ -56,10 +56,10 @@ void ThroughputRecorder::Start(PayloadType payload_type, (payload_direction == PayloadDirection::INCOMING_PAYLOAD) ? "; Receive" : "; Send"; - LOG(INFO) << "Start TP profiling for payload_id:" << payload_id_ << direction; + VLOG(1) << "Start TP profiling for payload_id:" << payload_id_ << direction; if (payload_type == PayloadType::kUnknown) { - LOG(INFO) << "Ignore ThroughputRecorder::start for Unknown Payload type"; + VLOG(1) << "Ignore ThroughputRecorder::start for Unknown Payload type"; return; } @@ -72,9 +72,9 @@ void ThroughputRecorder::Start(PayloadType payload_type, bool ThroughputRecorder::Stop() { MutexLock lock(&mutex_); - LOG(INFO) << "Stop TP profiling for payload_id:" << payload_id_; + VLOG(1) << "Stop TP profiling for payload_id:" << payload_id_; if (payload_type_ == PayloadType::kUnknown) { - LOG(INFO) << "Ignore ThroughputRecorder::stop as it never start"; + VLOG(1) << "Ignore ThroughputRecorder::stop as it never start"; return false; } { @@ -218,7 +218,7 @@ void ThroughputRecorder::OnFrameSent(Medium medium, PacketMetaData& packetMetaData) { MutexLock lock(&mutex_); if (payload_type_ == PayloadType::kUnknown) { - LOG(INFO) << "PayloadType is invalid, return"; + VLOG(1) << "PayloadType is invalid, return"; return; } @@ -236,7 +236,7 @@ void ThroughputRecorder::OnFrameReceived(Medium medium, PacketMetaData& packetMetaData) { MutexLock lock(&mutex_); if (payload_type_ == PayloadType::kUnknown) { - LOG(INFO) << "PayloadType is invalid, return"; + VLOG(1) << "PayloadType is invalid, return"; return; } @@ -274,10 +274,9 @@ std::string ThroughputRecorder::ToString(PayloadType type) { void ThroughputRecorderContainer::Shutdown() { MutexLock lock(&mutex_); - LOG(INFO) << __func__ - << ". Num of Instance:" << throughput_recorders_.size(); + VLOG(1) << __func__ << ". Num of Instance:" << throughput_recorders_.size(); for (auto& throughput_recorder : throughput_recorders_) { - LOG(INFO) << "Stop instance: " << throughput_recorder.second; + VLOG(1) << "Stop instance: " << throughput_recorder.second; throughput_recorder.second->Stop(); delete throughput_recorder.second; } @@ -294,8 +293,8 @@ ThroughputRecorder* ThroughputRecorderContainer::GetTPRecorder( std::string direction = (payload_direction == PayloadDirection::INCOMING_PAYLOAD) ? "; Receive" : "; Send"; - LOG(INFO) << "Add ThroughputRecorder instance : " << instance - << " for payload_id:" << payload_id << direction; + VLOG(1) << "Add ThroughputRecorder instance : " << instance + << " for payload_id:" << payload_id << direction; throughput_recorders_.emplace( std::pair(payload_id, payload_direction), instance); @@ -314,15 +313,15 @@ void ThroughputRecorderContainer::StopTPRecorder( auto it = throughput_recorders_.find( std::pair(payload_id, payload_direction)); if (it != throughput_recorders_.end()) { - LOG(INFO) << "Found and stop/delete ThroughputRecorder instance : " - << &(it->second) << " for payload_id:" << payload_id << direction; + VLOG(1) << "Found and stop/delete ThroughputRecorder instance : " + << &(it->second) << " for payload_id:" << payload_id << direction; it->second->Stop(); delete it->second; throughput_recorders_.erase( std::pair(payload_id, payload_direction)); return; } - LOG(INFO) << "No ThroughputRecorder found for :" << payload_id; + VLOG(1) << "No ThroughputRecorder found for :" << payload_id; } int ThroughputRecorderContainer::GetSize() { diff --git a/connections/implementation/base_pcp_handler.cc b/connections/implementation/base_pcp_handler.cc index bd81360e..b30cd4cf 100644 --- a/connections/implementation/base_pcp_handler.cc +++ b/connections/implementation/base_pcp_handler.cc @@ -1433,7 +1433,7 @@ Status BasePcpHandler::AcceptConnection(ClientProxy* client, "accept-connection", [this, client, endpoint_id, payload_listener = std::move(payload_listener), &response]() RUN_ON_PCP_HANDLER_THREAD() mutable { - LOG(INFO) << "AcceptConnection: endpoint_id=" << endpoint_id; + VLOG(1) << "AcceptConnection: endpoint_id=" << endpoint_id; if (!pending_connections_.count(endpoint_id)) { LOG(INFO) << "AcceptConnection: no pending connection for endpoint_id=" diff --git a/connections/implementation/client_proxy.cc b/connections/implementation/client_proxy.cc index 9ba2ddbe..11a608d1 100644 --- a/connections/implementation/client_proxy.cc +++ b/connections/implementation/client_proxy.cc @@ -133,8 +133,6 @@ std::string ClientProxy::GetLocalEndpointId() { } if (external_device_provider_ == nullptr) { local_endpoint_id_ = GenerateLocalEndpointId(); - LOG(INFO) << __func__ - << ": Locally generating endpoint id: " << local_endpoint_id_; } else { local_endpoint_id_ = external_device_provider_->GetLocalDevice()->GetEndpointId(); @@ -206,6 +204,8 @@ std::string ClientProxy::GenerateLocalEndpointId() { for (int i = 0; i < kEndpointIdLength; i++) { id += kEndpointIdChars[prng.NextUint32() % sizeof(kEndpointIdChars)]; } + LOG(INFO) << "ClientProxy [Local Endpoint Generated]: client=" + << GetClientId() << "; endpoint_id=" << id; return id; } @@ -1149,16 +1149,15 @@ void ClientProxy::ExitHighVisibilityMode() { void ClientProxy::EnterStableEndpointIdMode() { MutexLock lock(&mutex_); - LOG(INFO) << "ClientProxy [EnterStableEndpointIdMode]: client=" - << GetClientId(); + VLOG(1) << "ClientProxy [EnterStableEndpointIdMode]: client=" + << GetClientId(); stable_endpoint_id_mode_ = true; } void ClientProxy::ExitStableEndpointIdMode() { MutexLock lock(&mutex_); - LOG(INFO) << "ClientProxy [ExitStableEndpointIdMode]: client=" - << GetClientId(); + VLOG(1) << "ClientProxy [ExitStableEndpointIdMode]: client=" << GetClientId(); stable_endpoint_id_mode_ = false; ScheduleClearCachedEndpointIdAlarm(); @@ -1299,11 +1298,10 @@ bool ClientProxy::IsMultiplexSocketSupported(absl::string_view endpoint_id, bool ClientProxy::GetWebRtcNonCellular() { return webrtc_non_cellular_; } void ClientProxy::SetWebRtcNonCellular(bool webrtc_non_cellular) { - std::string allow_webrtc_cellular_str = - webrtc_non_cellular ? "disallow" : "allow"; - LOG(INFO) << "ClientProxy: client=" << GetClientId() - << allow_webrtc_cellular_str << " to use mobile data.", - webrtc_non_cellular_ = webrtc_non_cellular; + VLOG(1) << "ClientProxy: client=" << GetClientId() + << (webrtc_non_cellular ? " disallow" : " allow") + << " to use mobile data."; + webrtc_non_cellular_ = webrtc_non_cellular; } bool ClientProxy::IsDctEnabled() const { return is_dct_enabled_; } diff --git a/connections/implementation/mediums/ble_v2.cc b/connections/implementation/mediums/ble_v2.cc index ef072030..ed3b2471 100644 --- a/connections/implementation/mediums/ble_v2.cc +++ b/connections/implementation/mediums/ble_v2.cc @@ -1108,8 +1108,8 @@ void BleV2::ProcessFetchGattAdvertisementsRequest( bool BleV2::StopAdvertisementGattServerLocked() { if (!IsAdvertisementGattServerRunningLocked()) { - LOG(INFO) << "Unable to stop the advertisement GATT server because " - "it's not running."; + VLOG(1) << "Unable to stop the advertisement GATT server because it's not " + "running."; return false; } diff --git a/connections/implementation/offline_service_controller.cc b/connections/implementation/offline_service_controller.cc index 62ca44e8..4e667773 100644 --- a/connections/implementation/offline_service_controller.cc +++ b/connections/implementation/offline_service_controller.cc @@ -41,11 +41,11 @@ namespace connections { OfflineServiceController::~OfflineServiceController() { Stop(); } void OfflineServiceController::Stop() { - LOG(INFO) << "Initiating shutdown of OfflineServiceController."; + VLOG(1) << "Initiating shutdown of OfflineServiceController."; if (stop_.Set(true)) return; payload_manager_.DisconnectFromEndpointManager(); pcp_manager_.DisconnectFromEndpointManager(); - LOG(INFO) << "OfflineServiceController has shut down."; + VLOG(1) << "OfflineServiceController has shut down."; } Status OfflineServiceController::StartAdvertising( @@ -172,18 +172,18 @@ void OfflineServiceController::SendPayload( ClientProxy* client, const std::vector& endpoint_ids, Payload payload) { if (stop_) return; - LOG(INFO) << "Client " << client->GetClientId() - << " is sending payload {id:" << payload.GetId() - << ", type:" << payload.GetType() << "} to endpoint_ids {" - << absl::StrJoin(endpoint_ids, ",") << "}"; + VLOG(1) << "Client " << client->GetClientId() + << " is sending payload {id:" << payload.GetId() + << ", type:" << payload.GetType() << "} to endpoint_ids {" + << absl::StrJoin(endpoint_ids, ",") << "}"; payload_manager_.SendPayload(client, endpoint_ids, std::move(payload)); } Status OfflineServiceController::CancelPayload(ClientProxy* client, std::int64_t payload_id) { if (stop_) return {Status::kOutOfOrderApiCall}; - LOG(INFO) << "Client " << client->GetClientId() << " cancelled payload " - << payload_id; + VLOG(1) << "Client " << client->GetClientId() << " cancelled payload " + << payload_id; return payload_manager_.CancelPayload(client, payload_id); } diff --git a/connections/implementation/p2p_cluster_pcp_handler.cc b/connections/implementation/p2p_cluster_pcp_handler.cc index fad301a4..d2d3888c 100644 --- a/connections/implementation/p2p_cluster_pcp_handler.cc +++ b/connections/implementation/p2p_cluster_pcp_handler.cc @@ -182,7 +182,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( awdl_medium = awdl_result.value(); } if (awdl_medium != UNKNOWN_MEDIUM) { - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: Awdl added"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: Awdl added"; mediums_started_successfully.push_back(awdl_medium); } std::unique_ptr @@ -204,7 +204,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( wifi_lan_medium = wifi_lan_result.value(); } if (wifi_lan_medium != UNKNOWN_MEDIUM) { - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: WifiLan added"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: WifiLan added"; mediums_started_successfully.push_back(wifi_lan_medium); } std::unique_ptr @@ -238,9 +238,9 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( if (ble_medium_.StartLegacyAdvertising( service_id, local_endpoint_id, advertising_options.fast_advertisement_service_uuid)) { - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: " - "Ble legacy started advertising"; - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: " + "Ble legacy started advertising"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"; mediums_started_successfully.push_back(bluetooth_medium); bluetooth_classic_advertiser_client_id_ = client->GetClientId(); } else { @@ -263,7 +263,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( LOG(INFO) << __func__ << "Ble v2 started advertising for legacy device."; mediums_started_successfully.push_back(bluetooth_medium); - LOG(INFO) << __func__ << "After Ble v2, BT added"; + VLOG(1) << __func__ << "After Ble v2, BT added"; bluetooth_classic_advertiser_client_id_ = client->GetClientId(); } else { LOG(WARNING) << "P2pClusterPcpHandler::StartAdvertisingImpl: " @@ -272,7 +272,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( bluetooth_medium_.StopAcceptingConnections(service_id); } } else { - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"; mediums_started_successfully.push_back(bluetooth_medium); bluetooth_classic_advertiser_client_id_ = client->GetClientId(); } @@ -295,7 +295,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( local_endpoint_info, advertising_options, web_rtc_state); if (ble_result.has_value() && ble_result.value() != UNKNOWN_MEDIUM) { - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: Ble added"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: Ble added"; mediums_started_successfully.push_back(ble_result.value()); } } else { @@ -303,7 +303,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( local_endpoint_info, advertising_options, web_rtc_state); if (ble_result.has_value() && ble_result.value() != UNKNOWN_MEDIUM) { - LOG(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: Ble added"; + VLOG(1) << "P2pClusterPcpHandler::StartAdvertisingImpl: Ble added"; mediums_started_successfully.push_back(ble_result.value()); } } @@ -455,12 +455,11 @@ void P2pClusterPcpHandler::BluetoothDeviceDiscoveredHandler( } // Report the discovered endpoint to the client. - LOG(INFO) << "Found BluetoothDeviceName " << device_name_string - << " (with endpoint_id=" << device_name.GetEndpointId() - << " and endpoint_info=" - << absl::BytesToHexString( - device_name.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Found BluetoothDeviceName " << device_name_string + << " (with endpoint_id=" << device_name.GetEndpointId() + << " and endpoint_info=" + << absl::BytesToHexString(device_name.GetEndpointInfo().data()) + << ")."; OnEndpointFound( client, std::make_shared(BluetoothEndpoint{ @@ -526,21 +525,20 @@ void P2pClusterPcpHandler::BluetoothNameChangedHandler( if (bluetoothEndpoint->bluetooth_device.GetMacAddress() == device.GetMacAddress()) { // Report the BluetoothEndpoint as lost to the client. - LOG(INFO) << "Reporting lost BluetoothDevice " - << bluetoothEndpoint->bluetooth_device.GetName() - << ", due to device name change."; + VLOG(1) << "Reporting lost BluetoothDevice " + << bluetoothEndpoint->bluetooth_device.GetName() + << ", due to device name change."; OnEndpointLost(client, *endpoint); break; } } // Report the discovered endpoint to the client. - LOG(INFO) << "Found BluetoothDeviceName " << device_name_string - << " (with endpoint_id=" << device_name.GetEndpointId() - << " and endpoint_info=" - << absl::BytesToHexString( - device_name.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Found BluetoothDeviceName " << device_name_string + << " (with endpoint_id=" << device_name.GetEndpointId() + << " and endpoint_info=" + << absl::BytesToHexString(device_name.GetEndpointInfo().data()) + << ")."; OnEndpointFound( client, std::make_shared(BluetoothEndpoint{ @@ -581,8 +579,7 @@ void P2pClusterPcpHandler::BluetoothDeviceLostHandler( return; // Report the BluetoothEndpoint as lost to the client. - LOG(INFO) << "Processing lost BluetoothDeviceName " - << device_name_string; + VLOG(1) << "Processing lost BluetoothDeviceName " << device_name_string; OnEndpointLost(client, DiscoveredEndpoint{device_name.GetEndpointId(), device_name.GetEndpointInfo(), service_id, BLUETOOTH, @@ -659,13 +656,13 @@ void P2pClusterPcpHandler::BlePeripheralDiscoveredHandler( StopEndpointLostByMediumAlarm(advertisement.GetEndpointId(), BLE); // Report the discovered endpoint to the client. - LOG(INFO) << "Found BleAdvertisement " - << absl::BytesToHexString(advertisement_bytes.data()) - << " (with endpoint_id=" << advertisement.GetEndpointId() - << ", and endpoint_info=" - << absl::BytesToHexString( - advertisement.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Found BleAdvertisement " + << absl::BytesToHexString(advertisement_bytes.data()) + << " (with endpoint_id=" << advertisement.GetEndpointId() + << ", and endpoint_info=" + << absl::BytesToHexString( + advertisement.GetEndpointInfo().data()) + << ")."; OnEndpointFound( client, std::make_shared(BleEndpoint{ @@ -731,13 +728,13 @@ void P2pClusterPcpHandler::BlePeripheralLostHandler( found_ble_endpoints_.erase(item); // Report the discovered endpoint to the client. - LOG(INFO) << "Lost BleEndpoint for BlePeripheral " - << peripheral.GetName() - << " (with endpoint_id=" << ble_endpoint_state.endpoint_id - << " and endpoint_info=" - << absl::BytesToHexString( - ble_endpoint_state.endpoint_info.data()) - << ")."; + VLOG(1) << "Lost BleEndpoint for BlePeripheral " + << peripheral.GetName() + << " (with endpoint_id=" << ble_endpoint_state.endpoint_id + << " and endpoint_info=" + << absl::BytesToHexString( + ble_endpoint_state.endpoint_info.data()) + << ")."; OnEndpointLost(client, DiscoveredEndpoint{ ble_endpoint_state.endpoint_id, ble_endpoint_state.endpoint_info, @@ -838,7 +835,7 @@ void P2pClusterPcpHandler::BleV2PeripheralDiscoveredHandler( ble_endpoint_state.ble = true; found_endpoints_in_ble_discover_cb_[peripheral_id] = ble_endpoint_state; - LOG(INFO) << "Found " << advertisement.ToReadableString(); + VLOG(1) << "Found " << advertisement.ToReadableString(); StopEndpointLostByMediumAlarm(advertisement.GetEndpointId(), BLE); OnEndpointFound( client, @@ -926,13 +923,13 @@ void P2pClusterPcpHandler::BleV2PeripheralLostHandler( if (ble_endpoint_state.ble) { // Report the lost endpoint to the client. - LOG(INFO) << "Lost BleEndpoint for BlePeripheral " - << absl::BytesToHexString(peripheral.GetId().data()) - << " (with endpoint_id=" << advertisement.GetEndpointId() - << " and endpoint_info=" - << absl::BytesToHexString( - advertisement.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Lost BleEndpoint for BlePeripheral " + << absl::BytesToHexString(peripheral.GetId().data()) + << " (with endpoint_id=" << advertisement.GetEndpointId() + << " and endpoint_info=" + << absl::BytesToHexString( + advertisement.GetEndpointInfo().data()) + << ")."; OnEndpointLost(client, DiscoveredEndpoint{ advertisement.GetEndpointId(), advertisement.GetEndpointInfo(), @@ -943,13 +940,13 @@ void P2pClusterPcpHandler::BleV2PeripheralLostHandler( } if (ble_endpoint_state.bt) { // Report the lost endpoint to the client. - LOG(INFO) << "Lost BluetoothEndpoint for BlePeripheral " - << absl::BytesToHexString(peripheral.GetId().data()) - << " (with endpoint_id=" << advertisement.GetEndpointId() - << " and endpoint_info=" - << absl::BytesToHexString( - advertisement.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Lost BluetoothEndpoint for BlePeripheral " + << absl::BytesToHexString(peripheral.GetId().data()) + << " (with endpoint_id=" << advertisement.GetEndpointId() + << " and endpoint_info=" + << absl::BytesToHexString( + advertisement.GetEndpointInfo().data()) + << ")."; OnEndpointLost(client, DiscoveredEndpoint{ advertisement.GetEndpointId(), advertisement.GetEndpointInfo(), @@ -1070,14 +1067,14 @@ void P2pClusterPcpHandler::AwdlServiceDiscoveredHandler( } // Report the discovered endpoint to the client. - LOG(INFO) << "Found NsdServiceInfo " - << "with (service_name:" << service_info.GetServiceName() - << ", service_type:" << service_info.GetServiceType() - << ", endpoint_id:" << wifi_lan_service_info.GetEndpointId() - << ", endpoint_info:" - << absl::BytesToHexString( - wifi_lan_service_info.GetEndpointInfo().AsStringView()) - << ")."; + VLOG(1) << "Found NsdServiceInfo " + << "with (service_name:" << service_info.GetServiceName() + << ", service_type:" << service_info.GetServiceType() + << ", endpoint_id:" << wifi_lan_service_info.GetEndpointId() + << ", endpoint_info:" + << absl::BytesToHexString( + wifi_lan_service_info.GetEndpointInfo().AsStringView()) + << ")."; StopEndpointLostByMediumAlarm(wifi_lan_service_info.GetEndpointId(), AWDL); OnEndpointFound(client, std::make_shared(AwdlEndpoint{ @@ -1119,13 +1116,13 @@ void P2pClusterPcpHandler::AwdlServiceLostHandler( return; // Report the lost endpoint to the client. - LOG(INFO) << "Lost NsdServiceInfo " << service_info.GetServiceName() - << " (with endpoint_id=" - << wifi_lan_service_info.GetEndpointId() - << " and endpoint_info=" - << absl::BytesToHexString( - wifi_lan_service_info.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Lost NsdServiceInfo " << service_info.GetServiceName() + << " (with endpoint_id=" + << wifi_lan_service_info.GetEndpointId() + << " and endpoint_info=" + << absl::BytesToHexString( + wifi_lan_service_info.GetEndpointInfo().data()) + << ")."; OnEndpointLost(client, DiscoveredEndpoint{ wifi_lan_service_info.GetEndpointId(), wifi_lan_service_info.GetEndpointInfo(), @@ -1192,13 +1189,12 @@ void P2pClusterPcpHandler::WifiLanServiceDiscoveredHandler( } // Report the discovered endpoint to the client. - LOG(INFO) << "Found NsdServiceInfo " << service_info.GetServiceName() - << " (with endpoint_id=" - << wifi_lan_service_info.GetEndpointId() - << "and endpoint_info=" - << absl::BytesToHexString( - wifi_lan_service_info.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Found NsdServiceInfo " << service_info.GetServiceName() + << " (with endpoint_id=" + << wifi_lan_service_info.GetEndpointId() << "and endpoint_info=" + << absl::BytesToHexString( + wifi_lan_service_info.GetEndpointInfo().data()) + << ")."; StopEndpointLostByMediumAlarm(wifi_lan_service_info.GetEndpointId(), WIFI_LAN); OnEndpointFound(client, @@ -1241,13 +1237,13 @@ void P2pClusterPcpHandler::WifiLanServiceLostHandler( return; // Report the lost endpoint to the client. - LOG(INFO) << "Lost NsdServiceInfo " << service_info.GetServiceName() - << " (with endpoint_id=" - << wifi_lan_service_info.GetEndpointId() - << " and endpoint_info=" - << absl::BytesToHexString( - wifi_lan_service_info.GetEndpointInfo().data()) - << ")."; + VLOG(1) << "Lost NsdServiceInfo " << service_info.GetServiceName() + << " (with endpoint_id=" + << wifi_lan_service_info.GetEndpointId() + << " and endpoint_info=" + << absl::BytesToHexString( + wifi_lan_service_info.GetEndpointInfo().data()) + << ")."; OnEndpointLost(client, DiscoveredEndpoint{ wifi_lan_service_info.GetEndpointId(), wifi_lan_service_info.GetEndpointInfo(), @@ -3181,12 +3177,12 @@ ErrorOr P2pClusterPcpHandler::StartWifiLanAdvertising( << service_id; return {Error(wifi_lan_result.error().operation_result_code().value())}; } - LOG(INFO) << "In StartWifiLanAdvertising(" - << absl::BytesToHexString(local_endpoint_info.data()) - << "), client=" << client->GetClientId() - << " started listening for incoming WifiLan connections " - "to service_id = " - << service_id; + VLOG(1) << "In StartWifiLanAdvertising(" + << absl::BytesToHexString(local_endpoint_info.data()) + << "), client=" << client->GetClientId() + << " started listening for incoming WifiLan connections " + "to service_id = " + << service_id; } // Generate a WifiLanServiceInfo with which to become WifiLan discoverable. @@ -3235,11 +3231,11 @@ ErrorOr P2pClusterPcpHandler::StartWifiLanAdvertising( wifi_lan_medium_.StopAcceptingConnections(service_id); return {Error(wifi_lan_result.error().operation_result_code().value())}; } - LOG(INFO) << "In StartWifiLanAdvertising(" - << absl::BytesToHexString(local_endpoint_info.data()) - << "), client=" << client->GetClientId() - << " advertised with WifiLanServiceInfo " - << nsd_service_info.GetServiceName(); + VLOG(1) << "In StartWifiLanAdvertising(" + << absl::BytesToHexString(local_endpoint_info.data()) + << "), client=" << client->GetClientId() + << " advertised with WifiLanServiceInfo " + << nsd_service_info.GetServiceName(); return {WIFI_LAN}; } diff --git a/connections/implementation/payload_manager.cc b/connections/implementation/payload_manager.cc index 8dac70c9..bf71e788 100644 --- a/connections/implementation/payload_manager.cc +++ b/connections/implementation/payload_manager.cc @@ -93,19 +93,19 @@ bool PayloadManager::SendPayloadLoop( // Update the still-active recipients of this payload. if (available_endpoint_ids.empty()) { - LOG(INFO) << "PayloadManager short-circuiting payload_id=" - << pending_payload.GetInternalPayload()->GetId() - << " after sending " << next_chunk_offset - << " bytes because none of the endpoints are available anymore."; + VLOG(1) << "PayloadManager short-circuiting payload_id=" + << pending_payload.GetInternalPayload()->GetId() + << " after sending " << next_chunk_offset + << " bytes because none of the endpoints are available anymore."; return false; } // Check if the payload has been cancelled by the client and, if so, // notify the remaining recipients. if (pending_payload.IsLocallyCanceled()) { - LOG(INFO) << "Aborting send of payload_id=" - << pending_payload.GetInternalPayload()->GetId() << " at offset " - << next_chunk_offset << " since it is marked canceled."; + VLOG(1) << "Aborting send of payload_id=" + << pending_payload.GetInternalPayload()->GetId() << " at offset " + << next_chunk_offset << " since it is marked canceled."; HandleFinishedOutgoingPayload( client, available_endpoint_ids, payload_header, next_chunk_offset, OperationResultCode::CLIENT_CANCELLATION_LOCAL_CANCEL_PAYLOAD, @@ -154,8 +154,8 @@ bool PayloadManager::SendPayloadLoop( pending_payload.GetInternalPayload()->GetTotalSize() > 0 && pending_payload.GetInternalPayload()->GetTotalSize() < next_chunk_offset) { - LOG(INFO) << "Payload xfer failed: payload_id=" - << pending_payload.GetInternalPayload()->GetId(); + VLOG(1) << "Payload xfer failed: payload_id=" + << pending_payload.GetInternalPayload()->GetId(); HandleFinishedOutgoingPayload( client, available_endpoint_ids, payload_header, next_chunk_offset, OperationResultCode::IO_FILE_READING_ERROR, PayloadStatus::LOCAL_ERROR); @@ -172,9 +172,9 @@ bool PayloadManager::SendPayloadLoop( payload_header, payload_chunk, available_endpoint_ids, packet_meta_data); // Check whether at least one endpoint failed. if (!failed_endpoint_ids.empty()) { - LOG(INFO) << "Payload xfer: endpoints failed: payload_id=" - << payload_header.id() << "; endpoint_ids={" - << ToString(failed_endpoint_ids) << "}", + VLOG(1) << "Payload xfer: endpoints failed: payload_id=" + << payload_header.id() << "; endpoint_ids={" + << ToString(failed_endpoint_ids) << "}", HandleFinishedOutgoingPayload( client, failed_endpoint_ids, payload_header, next_chunk_offset, OperationResultCode::CONNECTIVITY_GENERIC_WRITING_CHANNEL_IO_ERROR, @@ -206,9 +206,9 @@ bool PayloadManager::SendPayloadLoop( if (!next_chunk_size) { // That was the last chunk, we're outta here. - LOG(INFO) << "Payload xfer done: payload_id=" - << pending_payload.GetInternalPayload()->GetId() - << "; size=" << next_chunk_offset; + VLOG(1) << "Payload xfer done: payload_id=" + << pending_payload.GetInternalPayload()->GetId() + << "; size=" << next_chunk_offset; ThroughputRecorderContainer::GetInstance() .GetTPRecorder(pending_payload.GetInternalPayload()->GetId(), PayloadDirection::OUTGOING_PAYLOAD) @@ -314,7 +314,7 @@ Payload::Id PayloadManager::CreateOutgoingPayload( } std::unique_ptr internal_payload = std::move(result.value()); Payload::Id payload_id = internal_payload->GetId(); - LOG(INFO) << "CreateOutgoingPayload: payload_id=" << payload_id; + VLOG(1) << "CreateOutgoingPayload: payload_id=" << payload_id; MutexLock lock(&mutex_); pending_payloads_.StartTrackingPayload( payload_id, @@ -333,7 +333,7 @@ PayloadManager::PayloadManager(EndpointManager& endpoint_manager) } void PayloadManager::CancelAllPayloads() { - LOG(INFO) << "PayloadManager: canceling payloads; self=" << this; + VLOG(1) << "PayloadManager: canceling payloads; self=" << this; { MutexLock lock(&mutex_); int pending_outgoing_payloads = 0; @@ -349,9 +349,9 @@ void PayloadManager::CancelAllPayloads() { } } if (shutdown_barrier_) { - LOG(INFO) << "PayloadManager: waiting for pending outgoing " - "payloads; self=" - << this; + VLOG(1) << "PayloadManager: waiting for pending outgoing " + "payloads; self=" + << this; shutdown_barrier_->Await(); } } @@ -363,11 +363,11 @@ void PayloadManager::DisconnectFromEndpointManager() { } PayloadManager::~PayloadManager() { - LOG(INFO) << "PayloadManager: going down; self=" << this; + VLOG(1) << "PayloadManager: going down; self=" << this; ThroughputRecorderContainer::GetInstance().Shutdown(); DisconnectFromEndpointManager(); CancelAllPayloads(); - LOG(INFO) << "PayloadManager: turn down payload executors; self=" << this; + VLOG(1) << "PayloadManager: turn down payload executors; self=" << this; bytes_payload_executor_.Shutdown(); stream_payload_executor_.Shutdown(); file_payload_executor_.Shutdown(); @@ -378,25 +378,25 @@ PayloadManager::~PayloadManager() { RunOnStatusUpdateThread( "~payload-manager", [this, &stop_latch]() RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() { - LOG(INFO) << "PayloadManager: stop tracking payloads; self=" << this; + VLOG(1) << "PayloadManager: stop tracking payloads; self=" << this; MutexLock lock(&mutex_); pending_payloads_.StopTrackingAllPayloads(); stop_latch.CountDown(); }); stop_latch.Await(); - LOG(INFO) << "PayloadManager: turn down notification executor; self=" << this; + VLOG(1) << "PayloadManager: turn down notification executor; self=" << this; // Stop all the ongoing Runnables (as gracefully as possible). payload_status_update_executor_.Shutdown(); - LOG(INFO) << "PayloadManager: down; self=" << this; + VLOG(1) << "PayloadManager: down; self=" << this; } bool PayloadManager::NotifyShutdown() { MutexLock lock(&mutex_); if (!shutdown_.Get()) return false; if (!shutdown_barrier_) return false; - LOG(INFO) << "PayloadManager [shutdown mode]"; + VLOG(1) << "PayloadManager [shutdown mode]"; shutdown_barrier_->CountDown(); return true; } @@ -405,7 +405,7 @@ void PayloadManager::SendPayload(ClientProxy* client, const EndpointIds& endpoint_ids, Payload payload) { if (shutdown_.Get()) return; - LOG(INFO) << "SendPayload: endpoint_ids={" << ToString(endpoint_ids) << "}"; + VLOG(1) << "SendPayload: endpoint_ids={" << ToString(endpoint_ids) << "}"; // Before transfer to internal payload, retrieves the Payload size for // analytics. std::int64_t payload_total_size; @@ -431,10 +431,10 @@ void PayloadManager::SendPayload(ClientProxy* client, client, endpoint_ids, payload.GetId(), payload.GetType(), payload.GetOffset(), payload_total_size, OperationResultCode::NEARBY_GENERIC_OUTGOING_PAYLOAD_CREATION_FAILURE); - LOG(INFO) << "PayloadManager failed to determine the right executor for " - "outgoing payload_id=" - << payload.GetId() - << ", payload_type=" << ToString(payload.GetType()); + VLOG(1) << "PayloadManager failed to determine the right executor for " + "outgoing payload_id=" + << payload.GetId() + << ", payload_type=" << ToString(payload.GetType()); return; } @@ -461,11 +461,10 @@ void PayloadManager::SendPayload(ClientProxy* client, payload_total_size, OperationResultCode:: NEARBY_GENERIC_OUTGOING_PAYLOAD_CREATION_FAILURE); - LOG(INFO) - << "PayloadManager failed to create InternalPayload for outgoing " - "payload_id=" - << payload_id << ", payload_type=" << ToString(payload_type) - << ", aborting sendPayload()."; + VLOG(1) << "PayloadManager failed to create InternalPayload for outgoing " + "payload_id=" + << payload_id << ", payload_type=" << ToString(payload_type) + << ", aborting sendPayload()."; return; } auto* internal_payload = pending_payload->GetInternalPayload(); @@ -498,9 +497,9 @@ void PayloadManager::SendPayload(ClientProxy* client, DestroyPendingPayload(payload_id); }); }); - LOG(INFO) << "PayloadManager: xfer scheduled: self=" << this - << "; payload_id=" << payload_id - << ", payload_type=" << ToString(payload_type); + VLOG(1) << "PayloadManager: xfer scheduled: self=" << this + << "; payload_id=" << payload_id + << ", payload_type=" << ToString(payload_type); } PayloadManager::PendingPayloadHandle PayloadManager::GetPayload( @@ -512,16 +511,16 @@ Status PayloadManager::CancelPayload(ClientProxy* client, Payload::Id payload_id) { PendingPayloadHandle canceled_payload = GetPayload(payload_id); if (!canceled_payload) { - LOG(INFO) << "Client requested cancel for unknown payload_id=" << payload_id - << ", ignoring."; + VLOG(1) << "Client requested cancel for unknown payload_id=" << payload_id + << ", ignoring."; return {Status::kPayloadUnknown}; } // Mark the payload as canceled. canceled_payload->MarkLocallyCanceled(); - LOG(INFO) << "Cancelling " - << (canceled_payload->IsIncoming() ? "incoming" : "outgoing") - << " payload_id=" << payload_id << " at request of client."; + VLOG(1) << "Cancelling " + << (canceled_payload->IsIncoming() ? "incoming" : "outgoing") + << " payload_id=" << payload_id << " at request of client."; // Return SUCCESS immediately. Remaining cleanup and updates will be sent // in SendPayload() or OnIncomingFrame() @@ -552,16 +551,15 @@ void PayloadManager::OnIncomingFrame(OfflineFrame& offline_frame, is_last); } } - LOG(INFO) - << "PayloadManager skipped process payloads before PCP connected, " - << frame.payload_header().id(); + VLOG(1) << "PayloadManager skipped process payloads before PCP connected, " + << frame.payload_header().id(); return; } switch (frame.packet_type()) { case PayloadTransferFrame::CONTROL: - LOG(INFO) << "PayloadManager::OnIncomingFrame [CONTROL]: self=" << this - << "; endpoint_id=" << from_endpoint_id; + VLOG(1) << "PayloadManager::OnIncomingFrame [CONTROL]: self=" << this + << "; endpoint_id=" << from_endpoint_id; ProcessControlPacket(to_client, from_endpoint_id, frame); break; case PayloadTransferFrame::DATA: @@ -569,9 +567,9 @@ void PayloadManager::OnIncomingFrame(OfflineFrame& offline_frame, packet_meta_data); break; case PayloadTransferFrame::PAYLOAD_ACK: - LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender " - "received payload ack from " - << from_endpoint_id; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender " + "received payload ack from " + << from_endpoint_id; ProcessPayloadAckPacket(from_endpoint_id, frame); break; default: @@ -670,7 +668,7 @@ PayloadStatus PayloadManager::EndpointInfoStatusToPayloadStatus( case EndpointInfo::Status::kAvailable: return PayloadStatus::SUCCESS; default: - LOG(INFO) << "PayloadManager: Unknown PayloadStatus"; + VLOG(1) << "PayloadManager: Unknown PayloadStatus"; return PayloadStatus::UNKNOWN_PAYLOAD_STATUS; } } @@ -685,7 +683,7 @@ OperationResultCode PayloadManager::EndpointInfoStatusToOperationResultCode( case EndpointInfo::Status::kAvailable: return OperationResultCode::DETAIL_SUCCESS; default: - LOG(INFO) << "PayloadManager: Unknown PayloadStatus"; + VLOG(1) << "PayloadManager: Unknown PayloadStatus"; return OperationResultCode::DETAIL_UNKNOWN; } } @@ -698,7 +696,7 @@ PayloadStatus PayloadManager::ControlMessageEventToPayloadStatus( case PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED: return PayloadStatus::REMOTE_CANCELLATION; default: - LOG(INFO) << "PayloadManager: unknown event=" << event; + VLOG(1) << "PayloadManager: unknown event=" << event; return PayloadStatus::UNKNOWN_PAYLOAD_STATUS; } } @@ -711,7 +709,7 @@ OperationResultCode PayloadManager::ControlMessageEventToOperationResultCode( case PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED: return OperationResultCode::CLIENT_CANCELLATION_REMOTE_CANCEL_PAYLOAD; default: - LOG(INFO) << "PayloadManager: unknown event=" << event; + VLOG(1) << "PayloadManager: unknown event=" << event; return OperationResultCode::DETAIL_UNKNOWN; } } @@ -802,7 +800,7 @@ PayloadManager::CreateIncomingPayload(const PayloadTransferFrame& frame, } std::unique_ptr internal_payload = std::move(result.value()); Payload::Id payload_id = internal_payload->GetId(); - LOG(INFO) << "CreateIncomingPayload: payload_id=" << payload_id; + VLOG(1) << "CreateIncomingPayload: payload_id=" << payload_id; pending_payloads_.StartTrackingPayload( payload_id, std::make_unique( @@ -812,8 +810,8 @@ PayloadManager::CreateIncomingPayload(const PayloadTransferFrame& frame, } void PayloadManager::OnPendingPayloadDestroy(const PendingPayload* payload) { - LOG(INFO) << "PayloadManager: destroying " << payload->ToString() - << " self=" << this; + VLOG(1) << "PayloadManager: destroying " << payload->ToString() + << " self=" << this; ThroughputRecorderContainer::GetInstance().StopTPRecorder( payload->GetId(), payload->IsIncoming() ? PayloadDirection::INCOMING_PAYLOAD @@ -932,13 +930,13 @@ void PayloadManager::SendPayloadReceivedAck(ClientProxy* client, "send_payload_ack", [this, &pending_payload, endpoint_id]() { endpoint_manager_->SendPayloadAck(pending_payload.GetId(), {endpoint_id}); - LOG(INFO) << "[safe-to-disconnect] Send " - "PAYLOAD_RECEIVED_ACK frame to: " - << endpoint_id << " done"; + VLOG(1) << "[safe-to-disconnect] Send " + "PAYLOAD_RECEIVED_ACK frame to: " + << endpoint_id << " done"; }); // Send the PAYLOAD_RECEIVED_ACK to the remote endpoint for the sender asap. - LOG(INFO) << "[safe-to-disconnect] " << pending_payload.GetId() - << " isLastChunk, receiver send ack to " << endpoint_id; + VLOG(1) << "[safe-to-disconnect] " << pending_payload.GetId() + << " isLastChunk, receiver send ack to " << endpoint_id; } bool PayloadManager::WaitForReceivedAck( @@ -951,25 +949,25 @@ bool PayloadManager::WaitForReceivedAck( return true; } - LOG(INFO) << "[safe-to-disconnect] Last Chunk, sender wait for " - "PAYLOAD_RECEIVED_ACK frame from: " - << endpoint_id; + VLOG(1) << "[safe-to-disconnect] Last Chunk, sender wait for " + "PAYLOAD_RECEIVED_ACK frame from: " + << endpoint_id; while (true) { PendingPayloadHandle latest_pending_payload = GetPayload(payload_header.id()); // Make sure we're still tracking this payload and its associated endpoint. if (!latest_pending_payload) { - LOG(INFO) << "[safe-to-disconnect] short-circuiting " - "latest_pending_payload is null for " - << payload_header.id() << ", stop wait ack."; + VLOG(1) << "[safe-to-disconnect] short-circuiting " + "latest_pending_payload is null for " + << payload_header.id() << ", stop wait ack."; return false; } auto* endpoint_info = latest_pending_payload->GetEndpoint(endpoint_id); if (endpoint_info == nullptr) { - LOG(INFO) << "[safe-to-disconnect] short-circuiting " - "endpointInfo is null for " - << payload_header.id() << ", stop wait ack."; + VLOG(1) << "[safe-to-disconnect] short-circuiting " + "endpointInfo is null for " + << payload_header.id() << ", stop wait ack."; return false; } @@ -979,9 +977,9 @@ bool PayloadManager::WaitForReceivedAck( client, {endpoint_id}, payload_header, payload_chunk_offset, OperationResultCode::CLIENT_CANCELLATION_LOCAL_CANCEL_PAYLOAD, PayloadStatus::LOCAL_CANCELLATION); - LOG(INFO) << "[safe-to-disconnect] short-circuiting local " - "payload cancellation for " - << payload_header.id() << ", stop wait ack."; + VLOG(1) << "[safe-to-disconnect] short-circuiting local " + "payload cancellation for " + << payload_header.id() << ", stop wait ack."; return false; } // Remote payload cancellation, etc @@ -991,17 +989,17 @@ bool PayloadManager::WaitForReceivedAck( client, {endpoint_id}, payload_header, payload_chunk_offset, OperationResultCode::CLIENT_CANCELLATION_REMOTE_CANCEL_PAYLOAD, EndpointInfoStatusToPayloadStatus(endpoint_info->status.Get())); - LOG(INFO) << "[safe-to-disconnect] short-circuiting remote " - "payload cancellation for " - << payload_header.id() << ", stop wait ack."; + VLOG(1) << "[safe-to-disconnect] short-circuiting remote " + "payload cancellation for " + << payload_header.id() << ", stop wait ack."; return false; } { MutexLock lock(&endpoint_info->payload_received_ack_mutex); if (endpoint_info->is_payload_received_ack) { - LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender already" - " received payload ack from " - << endpoint_id << ", stop wait PAYLOAD_RECEIVED_ACK."; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender already" + " received payload ack from " + << endpoint_id << ", stop wait PAYLOAD_RECEIVED_ACK."; endpoint_info->is_payload_received_ack = false; return true; } @@ -1011,23 +1009,23 @@ bool PayloadManager::WaitForReceivedAck( .wait_payload_received_ack_millis); if (!wait_exception.Ok()) { endpoint_info->is_payload_received_ack = false; - LOG(INFO) - << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender wait for " - "received payload ack from " - << endpoint_id << " end with exception: " << wait_exception.value; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender wait for " + "received payload ack from " + << endpoint_id + << " end with exception: " << wait_exception.value; return false; } if (endpoint_info->is_payload_received_ack) { - LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] Received " - "notification that sender " - "received payload ack from " - << endpoint_id; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] Received " + "notification that sender " + "received payload ack from " + << endpoint_id; endpoint_info->is_payload_received_ack = false; return true; } else { - LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender doesn't" - " received payload ack from " - << endpoint_id << ", end with timeout."; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender doesn't" + " received payload ack from " + << endpoint_id << ", end with timeout."; return false; } } @@ -1064,8 +1062,8 @@ void PayloadManager::HandleFinishedOutgoingPayload( PayloadTransferFrame::ControlMessage::PAYLOAD_ERROR); break; case PayloadStatus::LOCAL_CANCELLATION: - LOG(INFO) << "Sending PAYLOAD_CANCEL to receiver side; payload_id=" - << payload_header.id(); + VLOG(1) << "Sending PAYLOAD_CANCEL to receiver side; payload_id=" + << payload_header.id(); SendControlMessage( finished_endpoint_ids, payload_header, num_bytes_successfully_transferred, @@ -1084,9 +1082,9 @@ void PayloadManager::HandleFinishedOutgoingPayload( // No special handling needed for these. break; default: - LOG(INFO) << "PayloadManager: Unhandled finished outgoing payload with " - "payload_status=" - << status; + VLOG(1) << "PayloadManager: Unhandled finished outgoing payload with " + "payload_status=" + << status; break; } } @@ -1111,8 +1109,8 @@ void PayloadManager::HandleFinishedIncomingPayload( PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED); break; default: - LOG(INFO) << "Unhandled finished incoming payload_id=" - << payload_header.id() << " with payload_status=" << status; + VLOG(1) << "Unhandled finished incoming payload_id=" + << payload_header.id() << " with payload_status=" << status; break; } } @@ -1175,9 +1173,9 @@ void PayloadManager::HandleSuccessfulOutgoingChunk( PendingPayloadHandle pending_payload = GetPayload(payload_header.id()); if (!pending_payload || !pending_payload->GetEndpoint(endpoint_id)) { - LOG(INFO) << "HandleSuccessfulOutgoingChunk: endpoint not found: " - "endpoint_id=" - << endpoint_id; + VLOG(1) << "HandleSuccessfulOutgoingChunk: endpoint not found: " + "endpoint_id=" + << endpoint_id; return; } @@ -1376,9 +1374,9 @@ void PayloadManager::ProcessDataPacket( pending_payload = GetPayload(payload_id)]() RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() { if (!pending_payload) return; - LOG(INFO) << "PayloadManager received new payload_id=" - << pending_payload->GetInternalPayload()->GetId() - << " from endpoint_id=" << from_endpoint_id; + VLOG(1) << "PayloadManager received new payload_id=" + << pending_payload->GetInternalPayload()->GetId() + << " from endpoint_id=" << from_endpoint_id; to_client->OnPayload( from_endpoint_id, pending_payload->GetInternalPayload()->ReleasePayload()); @@ -1395,8 +1393,8 @@ void PayloadManager::ProcessDataPacket( if (pending_payload->IsLocallyCanceled()) { // This incoming payload was canceled by the client. Drop this frame and // do all the cleanup. See go/nc-cancel-payload - LOG(INFO) << "ProcessDataPacket: [cancel] endpoint_id=" << from_endpoint_id - << "; payload_id=" << pending_payload->GetId(); + VLOG(1) << "ProcessDataPacket: [cancel] endpoint_id=" << from_endpoint_id + << "; payload_id=" << pending_payload->GetId(); HandleFinishedIncomingPayload( to_client, from_endpoint_id, payload_header, payload_chunk.offset(), PayloadStatus::LOCAL_CANCELLATION, @@ -1457,17 +1455,16 @@ void PayloadManager::ProcessControlPacket( payload_transfer_frame.control_message(); PendingPayloadHandle pending_payload = GetPayload(payload_header.id()); if (!pending_payload) { - LOG(INFO) << "Got ControlMessage for unknown payload_id=" - << payload_header.id() - << ", ignoring: " << control_message.event(); + VLOG(1) << "Got ControlMessage for unknown payload_id=" + << payload_header.id() << ", ignoring: " << control_message.event(); return; } switch (control_message.event()) { case PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED: if (pending_payload->IsIncoming()) { - LOG(INFO) << "Incoming PAYLOAD_CANCELED: from endpoint_id=" - << from_endpoint_id << "; self=" << this; + VLOG(1) << "Incoming PAYLOAD_CANCELED: from endpoint_id=" + << from_endpoint_id << "; self=" << this; // No need to mark the pending payload as cancelled, since this is a // remote cancellation for an incoming payload -- we handle everything // inline here. @@ -1477,8 +1474,8 @@ void PayloadManager::ProcessControlPacket( ControlMessageEventToPayloadStatus(control_message.event()), ControlMessageEventToOperationResultCode(control_message.event())); } else { - LOG(INFO) << "Outgoing PAYLOAD_CANCELED: from endpoint_id=" - << from_endpoint_id << "; self=" << this; + VLOG(1) << "Outgoing PAYLOAD_CANCELED: from endpoint_id=" + << from_endpoint_id << "; self=" << this; // Mark the payload as canceled *for this endpoint*. pending_payload->SetEndpointStatusFromControlMessage(from_endpoint_id, control_message); @@ -1502,9 +1499,9 @@ void PayloadManager::ProcessControlPacket( } break; default: - LOG(INFO) << "Unhandled control message " << control_message.event() - << " for payload_id=" - << pending_payload->GetInternalPayload()->GetId(); + VLOG(1) << "Unhandled control message " << control_message.event() + << " for payload_id=" + << pending_payload->GetInternalPayload()->GetId(); break; } } @@ -1515,19 +1512,19 @@ void PayloadManager::ProcessPayloadAckPacket( auto payload_header = payload_transfer_frame.payload_header(); PendingPayloadHandle pending_payload = GetPayload(payload_header.id()); if (!pending_payload) { - LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] " - "short-circuiting got payload " - "ack for unknown payload " - << payload_header.id() << ", ignoring"; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] " + "short-circuiting got payload " + "ack for unknown payload " + << payload_header.id() << ", ignoring"; return; } if (pending_payload->IsIncoming()) { - LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] " - "short-circuiting got Payload " - "ack for incoming payload " - << payload_header.id() << ", ignoring"; + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] " + "short-circuiting got Payload " + "ack for incoming payload " + << payload_header.id() << ", ignoring"; } - LOG(INFO) + VLOG(1) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender received payload " << payload_header.id() << " ack from " << from_endpoint_id; pending_payload->MarkReceivedAckFromEndpoint(from_endpoint_id); @@ -1594,8 +1591,8 @@ PayloadManager::EndpointInfo::ControlMessageEventToEndpointInfoStatus( case PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED: return Status::kCanceled; default: - LOG(INFO) << "Unknown EndpointInfo.Status for ControlMessage.EventType " - << event; + VLOG(1) << "Unknown EndpointInfo.Status for ControlMessage.EventType " + << event; return Status::kUnknown; } } @@ -1745,7 +1742,7 @@ void PayloadManager::PendingPayloads::StartTrackingPayload( // If the |payload_id| is being re-used, always prefer the newer payload. Remove(pending_payloads_.find(payload_id)); - LOG(INFO) << "StartTrackingPayload: " << pending_payload->ToString(); + VLOG(1) << "StartTrackingPayload: " << pending_payload->ToString(); pending_payload->IncRefCount(); pending_payloads_[payload_id] = std::move(pending_payload); } @@ -1753,7 +1750,7 @@ void PayloadManager::PendingPayloads::StartTrackingPayload( void PayloadManager::PendingPayloads::StopTrackingPayload( Payload::Id payload_id) { MutexLock lock(&mutex_); - LOG(INFO) << "StopTrackingPayload " << payload_id; + VLOG(1) << "StopTrackingPayload " << payload_id; Remove(pending_payloads_.find(payload_id)); } diff --git a/internal/platform/implementation/windows/ble_v2.cc b/internal/platform/implementation/windows/ble_v2.cc index 47054a3f..82192b8e 100644 --- a/internal/platform/implementation/windows/ble_v2.cc +++ b/internal/platform/implementation/windows/ble_v2.cc @@ -315,25 +315,17 @@ bool BleV2Medium::StartAdvertising(const BleAdvertisementData& advertising_data, absl::BytesToHexString(it.second.AsStringView()) + "}"; } - LOG(INFO) << __func__ - << ": advertising_data.service_data=" << service_data_info - << ", tx_power_level=" - << TxPowerLevelToName(advertising_parameters.tx_power_level); + VLOG(1) << __func__ << ": advertising_data.service_data=" << service_data_info + << ", tx_power_level=" + << TxPowerLevelToName(advertising_parameters.tx_power_level); - if (advertising_data.is_extended_advertisement) { + if (advertising_data.is_extended_advertisement || + ble_gatt_server_ == nullptr) { // In BLE v2, the flag is set when the Bluetooth adapter supports extended // advertising and GATT server is using. - LOG(INFO) << __func__ << ": BLE advertising using BLE extended feature."; return StartBleAdvertising(advertising_data, advertising_parameters); - } else { - if (ble_gatt_server_ != nullptr) { - LOG(INFO) << __func__ << ": BLE advertising on GATT server."; - return StartGattAdvertising(advertising_data, advertising_parameters); - } else { - LOG(INFO) << __func__ << ": BLE fast advertising."; - return StartBleAdvertising(advertising_data, advertising_parameters); - } } + return StartGattAdvertising(advertising_data, advertising_parameters); } bool BleV2Medium::StopAdvertising() { @@ -641,7 +633,7 @@ bool BleV2Medium::StopScanning() { std::unique_ptr BleV2Medium::OpenServerSocket( const std::string& service_id) { - LOG(INFO) << "OpenServerSocket is called"; + VLOG(1) << "OpenServerSocket is called"; auto server_socket = std::make_unique(adapter_); @@ -691,7 +683,8 @@ bool BleV2Medium::IsExtendedAdvertisementsAvailable() { bool BleV2Medium::StartBleAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, api::ble_v2::AdvertiseParameters advertising_parameters) { - LOG(INFO) << __func__ << ": Start BLE advertising."; + LOG(INFO) << __func__ << ": Start BLE advertising, extended:" + << advertising_data.is_extended_advertisement; try { if (!adapter_->IsEnabled()) { LOG(WARNING) << "BLE cannot start advertising because the " @@ -725,7 +718,7 @@ bool BleV2Medium::StartBleAdvertising( LOG(WARNING) << "BLE failed to get service UUID."; return false; } - LOG(WARNING) << "BLE service UUID: " << absl::StrCat(absl::Hex(*uuid16)); + VLOG(1) << "BLE service UUID: " << absl::StrCat(absl::Hex(*uuid16)); data_writer.WriteUInt16(*uuid16); diff --git a/internal/platform/implementation/windows/ble_v2_server_socket.cc b/internal/platform/implementation/windows/ble_v2_server_socket.cc index 6c438d92..0f3a9a32 100644 --- a/internal/platform/implementation/windows/ble_v2_server_socket.cc +++ b/internal/platform/implementation/windows/ble_v2_server_socket.cc @@ -38,7 +38,7 @@ BleV2ServerSocket::BleV2ServerSocket(api::BluetoothAdapter* adapter) std::unique_ptr BleV2ServerSocket::Accept() { absl::MutexLock lock(&mutex_); - LOG(INFO) << __func__ << ": Accept is called."; + VLOG(1) << __func__ << ": Accept is called."; while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); @@ -55,7 +55,7 @@ std::unique_ptr BleV2ServerSocket::Accept() { Exception BleV2ServerSocket::Close() { // TODO(b/271031645): implement BLE socket using weave absl::MutexLock lock(&mutex_); - LOG(INFO) << __func__ << ": Close is called."; + VLOG(1) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; diff --git a/internal/platform/implementation/windows/bluetooth_adapter.cc b/internal/platform/implementation/windows/bluetooth_adapter.cc index d3049430..e19148c9 100644 --- a/internal/platform/implementation/windows/bluetooth_adapter.cc +++ b/internal/platform/implementation/windows/bluetooth_adapter.cc @@ -108,8 +108,8 @@ BluetoothAdapter::BluetoothAdapter() : windows_bluetooth_adapter_(nullptr) { // Synchronously sets the status of the BluetoothAdapter to 'status', and // returns true if the operation was a success. bool BluetoothAdapter::SetStatus(Status status) { - LOG(ERROR) << __func__ << ": Set Bluetooth radio status to " - << (status == Status::kEnabled ? "On" : "Off"); + LOG(INFO) << __func__ << ": Set Bluetooth radio status to " + << (status == Status::kEnabled ? "On" : "Off"); if (windows_bluetooth_radio_ == nullptr) { LOG(ERROR) << __func__ << ": No Bluetooth radio on this device."; return false; @@ -120,23 +120,23 @@ bool BluetoothAdapter::SetStatus(Status status) { if (status == Status::kDisabled && (radio_state == RadioState::Unknown || radio_state == RadioState::Off || radio_state == RadioState::Disabled)) { - LOG(INFO) << __func__ - << ": Skip set radio status kDisabled due to requested state is " - "already kDisabled."; + VLOG(1) << __func__ + << ": Skip set radio status kDisabled due to requested state is " + "already kDisabled."; return true; } if (status == Status::kEnabled && radio_state == RadioState::On) { - LOG(INFO) << __func__ - << ": Skip set radio status kEnabled due to requested state is " - "already kEnabled."; + VLOG(1) << __func__ + << ": Skip set radio status kEnabled due to requested state is " + "already kEnabled."; return true; } if (!FeatureFlags::GetInstance().GetFlags().enable_set_radio_state) { - LOG(INFO) << __func__ - << ": Attempt to set the radio state while " - "FeatureFlags::enable_set_radio_state is false."; + VLOG(1) << __func__ + << ": Attempt to set the radio state while " + "FeatureFlags::enable_set_radio_state is false."; return false; } @@ -497,9 +497,9 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { device_name_ = std::nullopt; if (registry_bluetooth_adapter_name_ == name) { - LOG(INFO) << __func__ - << ": Tried to set name for bluetooth adapter to the " - "same name again."; + VLOG(1) << __func__ + << ": Tried to set name for bluetooth adapter to the " + "same name again."; return true; } @@ -871,7 +871,8 @@ std::string BluetoothAdapter::GetNameFromRegistry(PHKEY hKey) const { // parameter, in bytes. if (status != ERROR_SUCCESS) { LOG(ERROR) << __func__ - << ": Failed to get the required size of the local name buffer"; + << ": Failed to get the required size of the local name buffer: " + << status; return ""; } unsigned char *local_name = new unsigned char[local_name_size]; diff --git a/internal/platform/implementation/windows/bluetooth_classic_medium.cc b/internal/platform/implementation/windows/bluetooth_classic_medium.cc index 927b77b3..9e804a14 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_medium.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_medium.cc @@ -117,7 +117,7 @@ BluetoothClassicMedium::~BluetoothClassicMedium() {} bool BluetoothClassicMedium::StartDiscovery( BluetoothClassicMedium::DiscoveryCallback discovery_callback) { - LOG(INFO) << "StartDiscovery is called."; + VLOG(1) << "StartDiscovery is called."; bool result = false; discovery_callback_ = std::move(discovery_callback); @@ -130,7 +130,7 @@ bool BluetoothClassicMedium::StartDiscovery( } bool BluetoothClassicMedium::StopDiscovery() { - LOG(INFO) << "StopDiscovery is called."; + VLOG(1) << "StopDiscovery is called."; bool result = false; @@ -251,8 +251,8 @@ std::unique_ptr BluetoothClassicMedium::ConnectToService( std::unique_ptr BluetoothClassicMedium::ListenForService(const std::string& service_name, const std::string& service_uuid) { - LOG(INFO) << "ListenForService is called with service name: " << service_name - << "."; + VLOG(1) << "ListenForService is called with service name: " << service_name + << "."; if (service_uuid.empty()) { LOG(ERROR) << __func__ << ": service_uuid was empty."; return nullptr; @@ -268,7 +268,7 @@ BluetoothClassicMedium::ListenForService(const std::string& service_name, scan_mode_ = bluetooth_adapter_.GetScanMode(); - LOG(INFO) << __func__ << ": scan_mode: " << static_cast(scan_mode_); + VLOG(1) << __func__ << ": scan_mode: " << static_cast(scan_mode_); bool radio_discoverable = scan_mode_ == BluetoothAdapter::ScanMode::kConnectableDiscoverable; @@ -284,7 +284,7 @@ BluetoothClassicMedium::ListenForService(const std::string& service_name, api::BluetoothDevice* BluetoothClassicMedium::GetRemoteDevice( const std::string& mac_address) { - LOG(INFO) << "GetRemoteDevice is called with mac_address: " << mac_address; + VLOG(1) << "GetRemoteDevice is called with mac_address: " << mac_address; return GetRemoteDeviceInternal(mac_address); } @@ -371,7 +371,7 @@ void BluetoothClassicMedium::OnScanModeChanged( << static_cast(scan_mode); if (scan_mode == scan_mode_) { - LOG(INFO) << __func__ << ": No change of scan mode."; + VLOG(1) << __func__ << ": No change of scan mode."; return; } @@ -387,7 +387,7 @@ void BluetoothClassicMedium::OnScanModeChanged( } if (is_radio_discoverable_ == radio_discoverable) { - LOG(INFO) << __func__ << ": No change of radio discovery."; + VLOG(1) << __func__ << ": No change of radio discovery."; return; } @@ -918,7 +918,7 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { } bool BluetoothClassicMedium::StopAdvertising() { - LOG(INFO) << __func__ << ": StopAdvertising is called"; + VLOG(1) << __func__ << ": StopAdvertising is called"; try { if (rfcomm_provider_ == nullptr) { diff --git a/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc b/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc index 09c7eab4..63b5e1a6 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc @@ -51,8 +51,8 @@ BluetoothServerSocket::~BluetoothServerSocket() { Close(); } // Returns nullptr on error. // Once error is reported, it is permanent, and ServerSocket has to be closed. std::unique_ptr BluetoothServerSocket::Accept() { - absl::MutexLock lock(&mutex_); - LOG(INFO) << __func__ << ": Accept is called."; + absl::MutexLock lock(mutex_); + VLOG(1) << __func__ << ": Accept is called."; while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); @@ -74,8 +74,8 @@ void BluetoothServerSocket::SetCloseNotifier( // Returns Exception::kIo on error, Exception::kSuccess otherwise. Exception BluetoothServerSocket::Close() { try { - absl::MutexLock lock(&mutex_); - LOG(INFO) << __func__ << ": Close is called."; + absl::MutexLock lock(mutex_); + VLOG(1) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -155,7 +155,7 @@ bool BluetoothServerSocket::listen() { ::winrt::fire_and_forget BluetoothServerSocket::Listener_ConnectionReceived( StreamSocketListener listener, StreamSocketListenerConnectionReceivedEventArgs const& args) { - absl::MutexLock lock(&mutex_); + absl::MutexLock lock(mutex_); LOG(INFO) << __func__ << ": Received connection."; if (closed_) { diff --git a/internal/platform/implementation/windows/nearby_server_socket.cc b/internal/platform/implementation/windows/nearby_server_socket.cc index 217886d5..bfdaf9d6 100644 --- a/internal/platform/implementation/windows/nearby_server_socket.cc +++ b/internal/platform/implementation/windows/nearby_server_socket.cc @@ -43,7 +43,7 @@ NearbyServerSocket::~NearbyServerSocket() { } bool NearbyServerSocket::Listen(const std::string& ip_address, int port) { - LOG(INFO) << "Listen to socket at " << ip_address << ":" << port; + VLOG(1) << "Listen to socket at " << ip_address << ":" << port; if (!is_socket_initiated_) { LOG(ERROR) << "Windows socket is not initiated."; return false; @@ -87,7 +87,7 @@ bool NearbyServerSocket::Listen(const std::string& ip_address, int port) { ip_address_ = ip_address; port_ = ntohs(local_address.sin_port); - LOG(INFO) << "Bound to " << ip_address_ << ":" << port_; + VLOG(1) << "Bound to " << ip_address_ << ":" << port_; if (::listen(/*s=*/socket_, /*backlog=*/SOMAXCONN) == SOCKET_ERROR) { LOG(ERROR) << "Failed to listen socket with error " << WSAGetLastError(); @@ -99,7 +99,7 @@ bool NearbyServerSocket::Listen(const std::string& ip_address, int port) { } std::unique_ptr NearbyServerSocket::Accept() { - LOG(INFO) << "Accept is called on NearbyServerSocket."; + VLOG(1) << "Accept is called on NearbyServerSocket."; if (!is_socket_initiated_) { LOG(WARNING) << "Windows socket is not initiated"; return nullptr; @@ -120,7 +120,7 @@ std::unique_ptr NearbyServerSocket::Accept() { inet_ntop(AF_INET, &(peer_address.sin_addr), client_ip, INET_ADDRSTRLEN); int client_port = ntohs(peer_address.sin_port); - LOG(INFO) << "Accepted emote device " << client_ip << ":" << client_port; + LOG(INFO) << "Accepted remote device " << client_ip << ":" << client_port; return std::make_unique(client_socket); } diff --git a/internal/platform/implementation/windows/wifi_hotspot_medium.cc b/internal/platform/implementation/windows/wifi_hotspot_medium.cc index 90b8bca0..a1b9f92d 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_medium.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_medium.cc @@ -113,11 +113,11 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotConnectionTimeoutMillis); - LOG(INFO) << "maximum connection retries=" - << wifi_hotspot_max_connection_retries - << ", connection interval=" << wifi_hotspot_retry_interval_millis - << "ms, connection timeout=" - << wifi_hotspot_client_socket_connect_timeout_millis << "ms"; + VLOG(1) << "maximum connection retries=" + << wifi_hotspot_max_connection_retries + << ", connection interval=" << wifi_hotspot_retry_interval_millis + << "ms, connection timeout=" + << wifi_hotspot_client_socket_connect_timeout_millis << "ms"; if (NearbyFlags::GetInstance().GetBoolFlag( nearby::platform::config_package_nearby::nearby_platform_feature:: @@ -273,7 +273,7 @@ WifiHotspotMedium::ListenForService(int port) { bool WifiHotspotMedium::StartWifiHotspot( HotspotCredentials* hotspot_credentials) { absl::MutexLock lock(&mutex_); - LOG(INFO) << __func__ << ": Start to create WiFi Hotspot."; + VLOG(1) << __func__ << ": Start to create WiFi Hotspot."; if (IsBeaconing()) { LOG(WARNING) << "Cannot create WiFi Hotspot again when it is running."; @@ -391,11 +391,11 @@ fire_and_forget WifiHotspotMedium::OnStatusChanged( LOG(INFO) << "WiFi SoftAP SSID: " << winrt::to_string( publisher_.Advertisement().LegacySettings().Ssid()); - LOG(INFO) << "WiFi SoftAP PW: " - << winrt::to_string(publisher_.Advertisement() - .LegacySettings() - .Passphrase() - .Password()); + VLOG(1) << "WiFi SoftAP PW: " + << winrt::to_string(publisher_.Advertisement() + .LegacySettings() + .Passphrase() + .Password()); } return winrt::fire_and_forget(); } else if (event.Status() == @@ -544,9 +544,9 @@ bool WifiHotspotMedium::ConnectWifiHotspot( NearbyFlags::GetInstance().GetInt64Flag( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotCheckIpIntervalMillis); - LOG(INFO) << "maximum IP check retries=" << ip_address_max_retries - << ", IP check interval=" << ip_address_retry_interval_millis - << "ms"; + VLOG(1) << "maximum IP check retries=" << ip_address_max_retries + << ", IP check interval=" << ip_address_retry_interval_millis + << "ms"; for (int i = 0; i < ip_address_max_retries; i++) { LOG(INFO) << "Check IP address at attempt " << i; std::vector ip_addresses = GetWifiIpv4Addresses(); diff --git a/internal/platform/implementation/windows/wifi_hotspot_native.cc b/internal/platform/implementation/windows/wifi_hotspot_native.cc index 8aa58d04..73d172a3 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_native.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_native.cc @@ -81,7 +81,7 @@ WifiHotspotNative::WifiHotspotNative() { return; } - LOG(INFO) << "WifiHotspotNative created successfully."; + VLOG(1) << "WifiHotspotNative created successfully."; } WifiHotspotNative::~WifiHotspotNative() { @@ -90,7 +90,7 @@ WifiHotspotNative::~WifiHotspotNative() { wifi_ = nullptr; } - LOG(INFO) << "WifiHotspotNative destroyed successfully."; + VLOG(1) << "WifiHotspotNative destroyed successfully."; } bool WifiHotspotNative::ConnectToWifiNetwork( diff --git a/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc b/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc index e286f8c0..e64691e9 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc @@ -71,11 +71,7 @@ std::string WifiHotspotServerSocket::GetIPAddress() const { } } - std::string hotspot_ip_address = GetHotspotIpAddress(); - LOG(INFO) << __func__ - << ": Return hotspot IP address: " << hotspot_ip_address; - - return hotspot_ip_address; + return GetHotspotIpAddress(); } } @@ -112,7 +108,7 @@ std::unique_ptr WifiHotspotServerSocket::Accept() { return std::make_unique(std::move(client_socket)); } else { absl::MutexLock lock(&mutex_); - LOG(INFO) << __func__ << ": Accept is called."; + VLOG(1) << __func__ << ": Accept is called."; if (NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: @@ -160,10 +156,8 @@ Exception WifiHotspotServerSocket::Close() { if (close_notifier_ != nullptr) { close_notifier_(); } - - LOG(INFO) << __func__ << ": Close completed successfully."; } else { - LOG(INFO) << __func__ << ": Close is called."; + VLOG(1) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -352,7 +346,7 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { SocketErrorNotice("Bind"); return false; } - LOG(INFO) << "Bind socket successful"; + VLOG(1) << "Bind socket successful"; int size = sizeof(serv_addr); memset(&serv_addr, 0, size); @@ -362,7 +356,6 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { return false; } port_ = ntohs(serv_addr.sin_port); - LOG(INFO) << "Hotspot Server bound to port: " << port_; socket_events_[kSocketEventListen] = WSACreateEvent(); if (socket_events_[kSocketEventListen] == WSA_INVALID_EVENT) { @@ -389,7 +382,7 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { return false; } LOG(INFO) << "Hotspot Server Socket " << listen_socket_ - << " started to listen."; + << " started to listen on port: " << port_; submittable_executor_.Execute([this]() { DWORD index; @@ -398,8 +391,8 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { index = WSAWaitForMultipleEvents(kSocketEventsCount, socket_events_, FALSE, WSA_INFINITE, FALSE); - LOG(INFO) << "Hotspot Server Socket " << listen_socket_ - << " received event index: " << index; + VLOG(1) << "Hotspot Server Socket " << listen_socket_ + << " received event index: " << index; if (index == WSA_WAIT_TIMEOUT || index == WSA_WAIT_FAILED) { LOG(INFO) << "Hotspot Server Socket timout or failed "; return false; @@ -424,7 +417,7 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { } if (network_events.lNetworkEvents & FD_ACCEPT) { client_socket_ = accept(listen_socket_, nullptr, nullptr); - LOG(INFO) << "Reveived FD_ACCEPT event."; + VLOG(1) << "Reveived FD_ACCEPT event."; if (client_socket_ == INVALID_SOCKET) { return false; @@ -461,9 +454,8 @@ bool WifiHotspotServerSocket::listen() { NearbyFlags::GetInstance().GetInt64Flag( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotCheckIpIntervalMillis); - LOG(INFO) << "maximum IP check retries=" << ip_address_max_retries - << ", IP check interval=" << ip_address_retry_interval_millis - << "ms"; + VLOG(1) << "maximum IP check retries=" << ip_address_max_retries + << ", IP check interval=" << ip_address_retry_interval_millis << "ms"; for (int i = 0; i < ip_address_max_retries; i++) { hotspot_ipaddr_ = GetHotspotIpAddress(); if (hotspot_ipaddr_.empty()) { diff --git a/internal/platform/implementation/windows/wifi_lan_mdns.cc b/internal/platform/implementation/windows/wifi_lan_mdns.cc index f0f130af..42257961 100644 --- a/internal/platform/implementation/windows/wifi_lan_mdns.cc +++ b/internal/platform/implementation/windows/wifi_lan_mdns.cc @@ -195,7 +195,7 @@ std::optional WifiLanMdns::GetComputerName() { void WifiLanMdns::DnsServiceRegisterComplete(DWORD Status, PVOID pQueryContext, PDNS_SERVICE_INSTANCE pInstance) { - LOG(INFO) << "DnsServiceRegisterComplete: " << Status; + VLOG(1) << "DnsServiceRegisterComplete: " << Status; WifiLanMdns* mdns = static_cast(pQueryContext); mdns->NotifyStatusUpdated(Status); } diff --git a/internal/platform/implementation/windows/wifi_lan_medium.cc b/internal/platform/implementation/windows/wifi_lan_medium.cc index 0a5270c0..6f4bb82e 100644 --- a/internal/platform/implementation/windows/wifi_lan_medium.cc +++ b/internal/platform/implementation/windows/wifi_lan_medium.cc @@ -86,10 +86,10 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo& nsd_service_info) { if ((server_socket.second->GetIPAddress() == nsd_service_info.GetIPAddress()) && (server_socket.second->GetPort() == nsd_service_info.GetPort())) { - LOG(INFO) << "Found the server socket." << " IP: " - << ipaddr_4bytes_to_dotdecimal_string( - nsd_service_info.GetIPAddress()) - << "; port: " << nsd_service_info.GetPort(); + VLOG(1) << "Found the server socket." << " IP: " + << ipaddr_4bytes_to_dotdecimal_string( + nsd_service_info.GetIPAddress()) + << "; port: " << nsd_service_info.GetPort(); server_socket_ptr = server_socket.second; socket_found = true; break; @@ -217,7 +217,6 @@ bool WifiLanMedium::StopAdvertising(const NsdServiceInfo& nsd_service_info) { bool result = wifi_lan_mdns_.StopMdnsService(); if (result) { - LOG(INFO) << "succeeded to stop mDNS advertising."; medium_status_ &= (~kMediumStatusAdvertising); return true; } diff --git a/internal/platform/implementation/windows/wifi_lan_socket.cc b/internal/platform/implementation/windows/wifi_lan_socket.cc index debc07ad..cbd9aaff 100644 --- a/internal/platform/implementation/windows/wifi_lan_socket.cc +++ b/internal/platform/implementation/windows/wifi_lan_socket.cc @@ -46,11 +46,11 @@ WifiLanSocket::WifiLanSocket(StreamSocket socket) { nearby::platform::config_package_nearby::nearby_platform_feature:: kEnableBlockingSocket); stream_soket_ = socket; - LOG(INFO) << "Socket send buffer size: " - << socket.Control().OutboundBufferSizeInBytes(); + VLOG(1) << "Socket send buffer size: " + << socket.Control().OutboundBufferSizeInBytes(); socket.Control().OutboundBufferSizeInBytes(4 * 1024 * 1024); - LOG(INFO) << "Updated send buffer size to: " - << socket.Control().OutboundBufferSizeInBytes(); + VLOG(1) << "Updated send buffer size to: " + << socket.Control().OutboundBufferSizeInBytes(); input_stream_ = SocketInputStream(socket.InputStream()); output_stream_ = SocketOutputStream(socket.OutputStream()); } diff --git a/sharing/incoming_frames_reader.cc b/sharing/incoming_frames_reader.cc index aecfcb23..a1b9423d 100644 --- a/sharing/incoming_frames_reader.cc +++ b/sharing/incoming_frames_reader.cc @@ -62,7 +62,7 @@ IncomingFramesReader::IncomingFramesReader(TaskRunner& service_thread, } IncomingFramesReader::~IncomingFramesReader() { - LOG(INFO) << "~IncomingFramesReader is called"; + VLOG(1) << "~IncomingFramesReader is called"; CloseAllPendingReads(); } diff --git a/sharing/nearby_connections_manager_impl.cc b/sharing/nearby_connections_manager_impl.cc index bf27e4db..2fc09a1c 100644 --- a/sharing/nearby_connections_manager_impl.cc +++ b/sharing/nearby_connections_manager_impl.cc @@ -507,15 +507,15 @@ void NearbyConnectionsManagerImpl::Send( } if (transfer_managers_.contains(endpoint_id) && payload->content.is_file()) { - LOG(INFO) << __func__ << ": Send payload " << payload->id << " to " - << endpoint_id << " to transfer manager. payload is file: " - << payload->content.is_file() << ", is bytes " - << payload->content.is_bytes(); + VLOG(1) << __func__ << ": Send payload " << payload->id << " to " + << endpoint_id << " to transfer manager. payload is file: " + << payload->content.is_file() << ", is bytes " + << payload->content.is_bytes(); transfer_managers_.at(endpoint_id) ->Send([&, endpoint_id = std::string(endpoint_id), payload_copy = *payload]() { - LOG(INFO) << __func__ << ": Send payload " << payload_copy.id - << " to " << endpoint_id; + VLOG(1) << __func__ << ": Send payload " << payload_copy.id << " to " + << endpoint_id; auto sent_payload = std::make_unique(payload_copy); SendWithoutDelay(endpoint_id, std::move(sent_payload)); }); @@ -528,14 +528,14 @@ void NearbyConnectionsManagerImpl::Send( void NearbyConnectionsManagerImpl::SendWithoutDelay( absl::string_view endpoint_id, std::unique_ptr payload) { - LOG(INFO) << __func__ << ": Send payload " << payload->id << " to " - << endpoint_id; + VLOG(1) << __func__ << ": Send payload " << payload->id << " to " + << endpoint_id; nearby_connections_service_->SendPayload( kServiceId, {std::string(endpoint_id)}, std::move(payload), [endpoint_id = std::string(endpoint_id)](ConnectionsStatus status) { - LOG(INFO) << __func__ << ": Sending payload to endpoint " << endpoint_id - << " attempted over Nearby Connections with result: " - << ConnectionsStatusToString(status); + VLOG(1) << __func__ << ": Sending payload to endpoint " << endpoint_id + << " attempted over Nearby Connections with result: " + << ConnectionsStatusToString(status); }); } @@ -628,19 +628,19 @@ void NearbyConnectionsManagerImpl::OnEndpointFound( absl::string_view endpoint_id, const DiscoveredEndpointInfo& info) { MutexLock lock(&mutex_); if (!discovery_listener_) { - LOG(INFO) << "Ignoring discovered endpoint " - << nearby::utils::HexEncode(info.endpoint_info) - << " because we're no longer " - "in discovery mode"; + VLOG(1) << "Ignoring discovered endpoint " + << nearby::utils::HexEncode(info.endpoint_info) + << " because we're no longer " + "in discovery mode"; return; } auto result = discovered_endpoints_.insert(std::string(endpoint_id)); if (!result.second) { - LOG(INFO) << "Ignoring discovered endpoint " - << nearby::utils::HexEncode(info.endpoint_info) - << " because we've already " - "reported this endpoint"; + VLOG(1) << "Ignoring discovered endpoint " + << nearby::utils::HexEncode(info.endpoint_info) + << " because we've already " + "reported this endpoint"; return; } @@ -653,14 +653,14 @@ void NearbyConnectionsManagerImpl::OnEndpointLost( absl::string_view endpoint_id) { MutexLock lock(&mutex_); if (!discovered_endpoints_.erase(endpoint_id)) { - LOG(INFO) << "Ignoring lost endpoint " << endpoint_id - << " because we haven't reported this endpoint"; + VLOG(1) << "Ignoring lost endpoint " << endpoint_id + << " because we haven't reported this endpoint"; return; } if (!discovery_listener_) { - LOG(INFO) << "Ignoring lost endpoint " << endpoint_id - << " because we're no longer in discovery mode"; + VLOG(1) << "Ignoring lost endpoint " << endpoint_id + << " because we're no longer in discovery mode"; return; } @@ -790,7 +790,7 @@ void NearbyConnectionsManagerImpl::OnBandwidthChanged( void NearbyConnectionsManagerImpl::OnPayloadReceived( absl::string_view endpoint_id, Payload& payload) { MutexLock lock(&mutex_); - LOG(INFO) << "Received payload id=" << payload.id; + VLOG(1) << "Received payload id=" << payload.id; if (NearbyFlags::GetInstance().GetBoolFlag( sharing::config_package_nearby::nearby_sharing_feature:: kDeleteUnexpectedReceivedFileFix)) { @@ -865,10 +865,10 @@ void NearbyConnectionsManagerImpl::RemoveStatusListenerForPayloadId( void NearbyConnectionsManagerImpl::OnPayloadTransferUpdate( absl::string_view endpoint_id, const PayloadTransferUpdate& update) { - LOG(INFO) << "Received payload transfer update id=" << update.payload_id - << ",status=" << PayloadStatusToString(update.status) - << ",total=" << update.total_bytes - << ",bytes_transferred=" << update.bytes_transferred; + VLOG(1) << "Received payload transfer update id=" << update.payload_id + << ",status=" << PayloadStatusToString(update.status) + << ",total=" << update.total_bytes + << ",bytes_transferred=" << update.bytes_transferred; // If this is a payload we've registered for, then forward its status to // the PayloadStatusListener if it still exists. We don't need to do @@ -919,7 +919,7 @@ void NearbyConnectionsManagerImpl::OnPayloadTransferUpdate( NearbyConnectionImpl* connection = GetConnectionForId(endpoint_id); if (connection == nullptr) return; - LOG(INFO) << "Writing incoming byte message to NearbyConnection."; + VLOG(1) << "Writing incoming byte message to NearbyConnection."; connection->WriteMessage(payload->content.bytes_payload.bytes); } diff --git a/sharing/nearby_sharing_service_impl.cc b/sharing/nearby_sharing_service_impl.cc index d6bfd95e..b2723ebe 100644 --- a/sharing/nearby_sharing_service_impl.cc +++ b/sharing/nearby_sharing_service_impl.cc @@ -3600,8 +3600,8 @@ void NearbySharingServiceImpl::RunOnNearbySharingServiceThreadDelayed( void NearbySharingServiceImpl::UpdateFilePathsInProgress( bool update_file_paths) { update_file_paths_in_progress_ = update_file_paths; - LOG(INFO) << __func__ - << ": Update file paths in progress: " << update_file_paths; + VLOG(1) << __func__ + << ": Update file paths in progress: " << update_file_paths; } } // namespace nearby::sharing