From 5bc92946692df75fc93b8e06503dc42fd13c10dc Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Fri, 6 Dec 2024 11:18:32 -0800 Subject: [PATCH] Update discovery_cache comments. PiperOrigin-RevId: 703558387 --- sharing/nearby_sharing_service_impl.cc | 5 ++++- sharing/nearby_sharing_service_impl.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sharing/nearby_sharing_service_impl.cc b/sharing/nearby_sharing_service_impl.cc index e2bec95a..c334b821 100644 --- a/sharing/nearby_sharing_service_impl.cc +++ b/sharing/nearby_sharing_service_impl.cc @@ -469,7 +469,8 @@ void NearbySharingServiceImpl::RegisterSendSurface( return; } - // Send items in discovery_cache as disabled. + // All share targets in discovery_cache have received_disabled set to + // true, send them to new send send surface in discovered events.. for (const auto& item : discovery_cache_) { LOG(INFO) << "Reporting receive_disabled discovery cache target " << item.second.share_target.ToString() @@ -3274,6 +3275,8 @@ bool NearbySharingServiceImpl::FindDuplicateInDiscoveryCache( "changed from: " << share_target.id << " to " << it->second.share_target.id << ". New endpoint_id: " << endpoint_id; + // Share targets in discovery cache have receive_disabled set to true. + // Copy only the id field from cache entry, share_target.id = it->second.share_target.id; discovery_cache_.erase(it); outgoing_share_target_map_.insert_or_assign(endpoint_id, share_target); diff --git a/sharing/nearby_sharing_service_impl.h b/sharing/nearby_sharing_service_impl.h index 478bdc9a..62fd2544 100644 --- a/sharing/nearby_sharing_service_impl.h +++ b/sharing/nearby_sharing_service_impl.h @@ -524,6 +524,7 @@ class NearbySharingServiceImpl absl::flat_hash_map outgoing_share_session_map_; // A map of Endpoint id to DiscoveryCacheEntry. + // All ShareTargets in discovery cache have received_disabled set to true. absl::flat_hash_map discovery_cache_; // For metrics. The IDs of ShareTargets that are cancelled while trying to // establish an outgoing connection.