Skip to content

CoreBluetooth: discover_services() can hang forever #486

Description

@qdot

Peripheral::discover_services() on CoreBluetooth can hang forever on several paths:

  1. src/corebluetooth/internal.rs discover_services() (~L1494): no else branch — if the peripheral is not in the map (e.g. after disconnect removal or clear_peripherals), the future is never completed.
  2. src/corebluetooth/central_delegate.rs didDiscoverServices (~L514): when error is Some, no event is sent, so the pending future is never resolved.
  3. central_delegate.rs didDiscoverCharacteristicsForService (~L572): on error no event is sent, so that service never becomes discovered and check_discovered never fires.
  4. A peripheral with zero services never calls check_discovered (only set_characteristics triggers it).

Fix direction: reply with an error for missing peripherals / delegate errors, and resolve immediately for an empty service set.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorebluetooth (macos/ios)Issues related to the MacOS/iOS CoreBluetooth impl

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions