steamclock / bluejay

A simple Swift framework for building reliable Bluetooth LE apps.
MIT License
1.09k stars 97 forks source link

Timeouts during repeated listens don't get flagged as errors #240

Closed nbrooke closed 3 years ago

nbrooke commented 3 years ago

The code in SynchronizedPeripheral.writeAndListen (and probably the other synchronized listen functions, though I haven't tested them), that checks for whether or not the operation timed out will count it as a success if ANY data was received, even if the operation times out eventually, this is likely to be incorrect for any multi-part listens, where you'd want it to count as an error any time the operation times out, even if some data had been received successfully.

nbrooke commented 3 years ago

Confirmed that the same issue happens on writeAndAssemble.

Also note that when this fake timeouts happen, endListen never gets called which can cause other failures (though I think just treating them properly as errors will probably fix that).