Repository navigation
Connect: a disconnect reaches the application, and one session per application - #1121
Merged
Merged
Conversation
…plication A grant ends when the player disconnects the application (DSM Amendment A11, MR-DSM-0292). The wallet ended its own row and told no one: the application's account answered every session as connected, whatever the wallet had done, so a game played on with a wallet that had left and its next request waited on a session that no longer existed. And approving a second code from an application already connected stacked a second session beside the first. - connect.disconnect posts the wallet's signed notice to the application over its relay: an AppResponseV1 at seq 0, which answers no request (requests count from 1). The session is ended on the wallet first, whether or not the application can be reached; an unreachable one is told at the next sync (the notice is kept in connect_log, unsent, and connect.sync delivers what a disconnected session still owes before skipping it). - The application's side holds the status: connect.app.respond ends the session on the notice, connect.app.request refuses an ended session, and connect.app.sessions reports the real status instead of Connected unconditionally. connect_app_sessions gains a status column; the client database schema moves to 31 (beta: reset, no migration). - connect.approve refuses a second session to an application already connected (session_with_app): disconnect it first to connect again. Two Connect e2e tests cover the notice over the relay, the status, the refusal, a second approval refused and a fresh session after; and the relay down at the disconnect with the notice going at the sync. The app host's real-connection test now asserts the application's status and its refusal after the disconnect. Mutations: the notice taken in but the session left connected, and the one-session guard removed, each red at its test.
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.
A grant ends when the player disconnects the application (DSM Amendment A11, MR-DSM-0292). Two things broke that on the phones:
connect.disconnectended the wallet's own row and told no one. The application's account hard-coded every session asConnected(app_session_view), so a game played on with a wallet that had left, and its next request waited on a session that no longer existed.connect.approverefused a second approval only for the same session id. Each new code is a new offer, so scanning again opened a second session to the same application beside the first.The change
connect.disconnectposts the wallet's signed notice over the application's relay: anAppResponseV1atseq = 0, which answers no request (requests count from 1). Nothing new on the wire. The session is ended on the wallet first, reachable or not; an unreachable application is told at the nextconnect.sync(the notice is kept inconnect_logunsent, and sync delivers what a disconnected session still owes before skipping it).connect.app.respondends the session on the notice,connect.app.requestrefuses an ended session, andconnect.app.sessionsreports the real status.connect_app_sessionsgains astatuscolumn; the client database schema moves to 31 (beta policy: reset, no migration).connect.approverefuses when a connected session to the sameapp_device_idexists: "disconnect it first to connect again". The Apps screen already shows that text.Verification
dsm_sdk::handlers::connect_e2e_tests10/10 (two new: the notice over the relay, the application's status and refusal, a second approval refused while a session stands and a fresh one after; the relay down at the disconnect with the kept notice going at the sync).dsm_app_host::real_connection::a_game_and_a_wallet_connect_over_the_real_relaynow asserts the application lists the session disconnected and refuses the payment it would ask (previously the request was accepted and left unanswered).make lint, the real-code guard andci/conformance_evidence.pypass.VERIFICATION_MATRIX.mdMR-DSM-0292 extended with the new gates, tests and mutations.bluetooth::android_ble_bridge::tests::pairing_smoke_identity_before_connectionfails the same way on untouchedmain.In Wildstate
The game server already checks sessions every five seconds (cryptskii/wildstate-dsm#13) and kicks a page whose session is disconnected. It could never fire until this, because the application's account always said "connected".