• Josh Nohle's avatar
    [Nearby] Clean up removed outgoing share targets · a4e95ea5
    Josh Nohle authored
    Before this CL, failed or cancelled send attempts resulted in duplicate
    share targets in the UI on the next send attempt. The root cause of
    this behavior was that the share target from the failed/cancelled
    attempt was overwritten in the endpoint-ID --> outgoing-share-target map
    during the second share attempt (using the same endpoint ID), and
    observers were not notified that the previous share target was removed.
    
    In this CL, we handle removal of outgoing share targets in a consistent
    way. The removal process is as follows:
      - The share target is removed from the |outgoing_share_target_map_|.
      - File payloads are released.
      - The share target info is removed from
        |outgoing_share_target_info_map_|.
      - Send-discovery observers are notified that a share target was lost.
    
    Fixed: 1133824
    Change-Id: Ia5faf674ae50e86a1d813d4e2f58d770248c95b9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2491221Reviewed-by: default avatarJames Vecore <vecore@google.com>
    Commit-Queue: Josh Nohle <nohle@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#819807}
    a4e95ea5
nearby_sharing_service_impl.h 19.7 KB