fix: PreviousServer is always nil#541
Merged
Merged
Conversation
fixes #539 closes #540 - Added a `previousServer` field to `ServerPreConnectEvent` and `serverConnection` to track the server a player was previously connected to. - Updated constructors and methods to accommodate the new `previousServer` parameter, improving connection request handling and event firing. - Enhanced `createConnectionRequest` to include the previous connection for better context during server transitions.
Deploying gate-minekube with
|
| Latest commit: |
e626bf1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://736c15bd.gate-minekube.pages.dev |
| Branch Preview URL: | https://fix-issue-539.gate-minekube.pages.dev |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the previous server was not properly tracked during player connections by adding a new previousServer field and updating the connection request and event firing functions.
- Added a new field previousServer to both ServerPreConnectEvent and serverConnection.
- Introduced createConnectionRequestWith to pass along the previous connection data.
- Updated related functions and events (handleKickEvent, session backend transition, newServerConnection, and newServerPreConnectEvent) to use the new parameter.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/edition/java/proxy/switch.go | Updated connection request and event initialization to include previousServer. |
| pkg/edition/java/proxy/session_backend_transition.go | Adjusted previous server tracking during session backend transitions. |
| pkg/edition/java/proxy/server.go | Modified newServerConnection to accept a previousServer parameter. |
| pkg/edition/java/proxy/events.go | Revised ServerPreConnectEvent constructor to include previousServer and added a getter. |
- Updated the handling of the previousServer field in ServerConnectedEvent and ServerPostConnectEvent to ensure it is only assigned when non-nil, preventing incorrect nil pointer storage. - This change enhances the integrity of event data during server transitions, ensuring accurate tracking of previous connections.
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.
fixes #539
closes #540
previousServerfield toServerPreConnectEventandserverConnectionto track the server a player was previously connected to.previousServerparameter, improving connection request handling and event firing.createConnectionRequestto include the previous connection for better context during server transitions.