Repository navigation
Conversation
…s down Refs ryanbr#1539. The ryanbr#1544 escape never armed on Apple. Every site that trips the pause runs inside didDisconnectPeripheral before that handler sets state.connected to false, and standingConnectWhilePausedIfDue read state.connected right there: the dying link still counted as up, so shouldStandingConnectWhilePaused refused and nothing was parked. The paused branch further down the same handler then refused as well, because the trip had just started the 10-minute floor. With the app backgrounded nothing else re-arms it, so the strap stayed disconnected until the app was next opened, the symptom ryanbr#1539 reported. Seen on a WHOOP MG: two connection timeouts within 11 s tripped the ryanbr#617 detector at 07:37:19, the log never printed "parking a standing connect", and the strap stayed disconnected for 49 minutes until the app was reopened, while a workout was being recorded. Android never had this. Its twin posts the check to the handler, so it runs after handleDisconnect has finished the teardown. The Swift side now does the same on the next main-queue turn, which covers all four call sites at once. The paused-disconnect line also said "strap keeps refusing to pair" for every pause, including the ryanbr#617 drops and the ryanbr#971/ryanbr#982 pairing that never finished, where no refusal was observed. Both platforms now record the cause with the latch and name it: "strap keeps refusing to pair", "pairing never finished" or "the link dropped within seconds of pairing N times in a row". Tests: BondLoopPauseParkingTests drives the real call order (trip while the link still reads connected, then tear down) and failed before the change; the wording is pinned on both platforms with identical strings (BondLoopPauseCauseTest). macOS StrandTests and the Android com.noop.ble unit tests pass; the iOS target builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1539
What was wrong
The #1544 standing-connect escape never armed on Apple. Every site that trips the bond-loop pause runs inside
didDisconnectPeripheralbefore that handler setsstate.connected = false, andstandingConnectWhilePausedIfDuereadstate.connectedright there. The dying link still counted as up, soshouldStandingConnectWhilePausedrefused and nothing was parked. The paused branch further down the same handler then refused too, because the trip had just started the 10-minute floor. With the app backgrounded nothing else re-arms it, so the strap stayed disconnected until the app was next opened, which is the symptom #1539 reported.Seen on a WHOOP MG (fw 50.41.1.0): two connection timeouts within 11 s tripped the #617 detector, the log never printed "parking a standing connect", and the strap stayed disconnected for 49 minutes while a workout was being recorded, until the app was reopened.
Android never had this: its twin posts the check to the handler, so it runs after
handleDisconnecthas finished the teardown.Change
standingConnectWhilePausedIfDueevaluates on the next main-queue turn, as the Kotlinhandler.postdoes. This covers all four call sites at once.BondLoopPauseCause, same phrases on both platforms): "strap keeps refusing to pair", "pairing never finished" or "the link dropped within seconds of pairing N times in a row".Verification
BondLoopPauseParkingTestsdrives the real call order (trip while the link still reads connected, then tear down). It failed before the change and passes after it.BondLoopPauseParkingTests,BondLoopPauseCauseTest).StrandTestsand the Androidcom.noop.bleunit tests pass; the iOS target builds.