Skip to content

WinRT: stale closed GATT service cache after unexpected disconnect/reconnect #484

Description

@qdot

In src/winrtble/peripheral.rs, the ConnectionStatusChanged handler only flips connected=false on an unexpected disconnect. It does not clear shared.ble_services (unlike explicit disconnect(), which does and documents why).

Failure scenario: device goes out of range → user calls connect() again → a new BLEDevice replaces the old one, and the old one's Drop closes every GattDeviceService. discover_services() then skips every UUID because of if !self.shared.ble_services.contains_key(&uuid), so the cache keeps the closed service/characteristic objects. Every subsequent read/write/subscribe fails until the user calls disconnect() explicitly. Calling connect() while already connected hits the same path.

Fix direction: clear the service cache whenever the underlying device is (re)created / on connect, and/or on unexpected disconnect.

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 workinguwp (windows)Issues related to the UWP/Win10 core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions