• Josh Nohle's avatar
    [Nearby] Cancel payloads via Nearby Connections before removing payloads · 07bc819f
    Josh Nohle authored
    Previously, the cancel implementation invoked the transfer-update
    callback before cancelling any ongoing payloads via Nearby Connections.
    The transfer-update callback subsequently cleaned up the payloads and
    disconnected before the payloads could be cancelled; so, the payloads
    would never be cancelled via Nearby Connections and the payload tracker
    would never receive a cancellation notification. This is particularly
    harmful to metrics.
    
    In this CL, we
      * cancel payloads via Nearby Connections before doing anytyhing else;
      * ensure that we provide enough time for the remote device to process
        cancellation before disconnecting;
      * make some memory-management improvements, such as copying the
        ShareTarget in DoCancel()--the notification manager owns the
        reference passed into Cancel(), and that could easily be invalidated
        during the cancellation process;
      * ensure that the payload tracker does not process trivial data sent
        during a cancellation, notably a 0 value for the number of bytes
        transferred.
    
    Manually verified all types of cancellation. Also, verified that
    existing metrics and the metrics of https:/crrev.com/c/2571443 are
    as expected. We still see crbug/1155412 and b/175064390, but those
    are known, unrelated issues.
    
    Fixed: 1156232
    Change-Id: I0d480b25d3565a21138d1ae32377cc4f4fcd87c4
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2577767
    Auto-Submit: Josh Nohle <nohle@chromium.org>
    Commit-Queue: James Vecore <vecore@google.com>
    Reviewed-by: default avatarJames Vecore <vecore@google.com>
    Cr-Commit-Position: refs/heads/master@{#834597}
    07bc819f
nearby_sharing_service_impl.cc 130 KB