Apollon77 / hap-controller-node

Node.js library to implement a HAP (HomeKit) controller
Mozilla Public License 2.0
54 stars 16 forks source link

Concurrent calls fail when pairVerify overlaps #81

Closed Apollon77 closed 2 years ago

Apollon77 commented 2 years ago

When the same controller opens two connections to a device and so tw o "PairVerifies" are sent to the device this will get mixed up on the pair process in the controller.

One option would be to use a "standing connection" and reusing it not just for subscriptions but in general or at all we need to queue the communication to the devcie. (For BLE in fact queueing is needed anyway)

Apollon77 commented 2 years ago

From specs: If a subsequent Pair Verify request from the same controller occurs in the middle of the Pair Verify procedure then the accessory must immediately tear down the existing session with the controller and must accept the newest request.

This in fact means that one controller should only have one pairing process in progress at a time, so we need to queue pair verifies