logout user in the case that the underlying connection gets disconnected#383
Draft
JacobBarthelmeh wants to merge 1 commit into
Draft
logout user in the case that the underlying connection gets disconnected#383JacobBarthelmeh wants to merge 1 commit into
JacobBarthelmeh wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures that an authenticated user session is properly logged out when the underlying communication channel is abruptly disconnected (not just on a clean COMM_CLOSE). It also defensively clears any stale auth session state during wh_Server_Init, in case the externally-owned auth context carries a leftover session from a prior connection.
Changes:
- In
wh_Server_SetConnected, invokewh_Auth_Logouton the transition toWH_COMM_DISCONNECTEDwhen a user is currently active. - In
wh_Server_Init, after binding the externally-owned auth context, log out any stale active user; fall back to zeroing the user struct if logout fails. - Add
_whTest_Auth_AbruptDisconnecttest that uses a wrappingtest_Logoutcallback to verify the disconnect path triggers exactly one logout and that repeated disconnects are no-ops.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/wh_server.c | Adds logout-on-disconnect in wh_Server_SetConnected and stale-session cleanup in wh_Server_Init. |
| test/wh_test_auth.c | Adds a logout-counting callback and a memory-transport test verifying logout fires on abrupt disconnect and is idempotent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d2a889c to
5985499
Compare
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.
Follow up to item 4 from #270