Skip to content

Handling Responses and Errors of Authentication - #51

Merged
Hazem-0 merged 5 commits into
developfrom
feat/auth
Jan 11, 2026
Merged

Handling Responses and Errors of Authentication#51
Hazem-0 merged 5 commits into
developfrom
feat/auth

Conversation

@Hazem-0

@Hazem-0 Hazem-0 commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

This PR improves the robustness of the authentication system. It prevents users from logging in from multiple devices simultaneously, handles database connection failures gracefully during auth, and fixes the response flow for user registration.

Key Changes:

Concurrent Login Prevention: Added isPlayerOnline check in GameServerManager and AuthenticationService. If a user is already online, the server now returns a USER_IS_ONLINE error action instead of allowing a second session.

Database Error Handling: Updated PlayerDAO and AuthenticationService to properly catch SQLException and handle null database connections. The server now returns an INTERNAL_SERVER_ERROR message to the client if the DB is down, rather than crashing or hanging.

Registration Flow: Fixed MessageRouter to correctly send the registration response message back to the client.

Refactoring:

Improved thread safety and logic in getAvailablePlayersMessage (GameServerManager).

Added logic to ensure the requesting player is not included in their own "Available Players" list.

@Hazem-0 Hazem-0 self-assigned this Jan 10, 2026
@Hazem-0 Hazem-0 added the enhancement New feature or request label Jan 10, 2026
@Hazem-0 Hazem-0 linked an issue Jan 10, 2026 that may be closed by this pull request
@Hazem-0
Hazem-0 requested a review from ZeiadT January 11, 2026 18:44
@Hazem-0
Hazem-0 merged commit cb4bf36 into develop Jan 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants