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.