Repository navigation
Move the mobile outbox out of the App Group container and keep live phone links - #391
oliverames wants to merge 3 commits into
Conversation
…hone links Moving the SQLite outbox into Application Support avoids 0xdead10cc kills when iOS suspends the app, and existing outboxes migrate automatically. On the Mac side, a duplicate connection from the same device no longer replaces a link that still answers a status check within the liveness timeout.
|
Hi @oliverames. Thanks for sending this. Two things before I merge it into
|
Mattt's mattt#391 review: - migrateFromAppGroup copies each file and removes the old ones only when every copy matches its source. A failed checkpoint or copy leaves the old outbox in place, and shared() opens the old outbox until the migration is complete, so queued records and anchors are never left behind. - answers(within:) no longer waits for the status call after the timer returns: the first of the call or the timer wins, and a silent socket can't hold the result open. - attach remembers whether the device was paired before the liveness check and refuses to install a link for a device unpaired during the wait. Tests cover the restartable migration, an unopenable database, the silent socket, and the unpair-during-check race.
|
Thanks @mattt. Both are fixed.
There are tests for the restartable migration, an unopenable database, the silent socket and the unpair-during-check race. |
…adable outbox accept() now attaches through attachIfPaired, which closes the link when the device was unpaired while the connection was being set up. An old outbox that cannot be opened is renamed to .unreadable in place, so shared() falls through to the new path and nothing in the App Group is opened.
|
@mattt I found two gaps left in my last round, both fixed. The unpair check only covered the liveness wait. An old outbox that couldn't be opened made |
Split out from #381 per #364.
0xdead10ccon suspend.MobileService.attach(_:)(MobilePeerLink.answers(within:)), so a second connection from the same device doesn't tear down an active link that is still responding.Review fixes
migrateFromAppGroupcopies each file and removes the old ones only when every copy matches its source. A failed checkpoint or copy leaves the old outbox in place, andshared()opens the old outbox until the migration is complete, so a partial migration can't strand queued records and anchors.answers(within:)no longer waits for the status call after the timer returns. The first of the call or the timer wins; a silent socket can't hold the result open.attachremembers whether the device was paired before the liveness check and refuses to install a link for a device unpaired during the wait.acceptchecks the pairing again right before it attaches, so an unpair that lands while the welcome, the MCP handshake and the peer connection are still being set up can't leave the forgotten device with a live link..unreadablesuffix instead of being opened on every launch, soshared()moves on to the new location and nothing stays open in the App Group. A failed checkpoint still leaves a readable old outbox in place.Testing
swift format lint --strictis clean on the changed files.imcp-serverTests: 254 tests, 1 skipped (pre-existing), 0 failures. New tests cover the restartable migration, quarantining an unopenable database and opening the new path after it, the silent socket, the unpair-during-check race, and refusing a device that's no longer paired at attach.accepttakes anNWConnection, so the unpair-during-setup race itself isn't driven end to end; the test covers the check it relies on.xcodebuild -scheme "iMCP iOS" -destination generic/platform=iOS CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO buildsucceeds.mattt/ios-app, and the repository's CI workflow runs on pull requests tomain, so there are no checks on this PR.