Skip to content

fix: PreviousServer is always nil #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2025
Merged

fix: PreviousServer is always nil #541

merged 2 commits into from
Jun 13, 2025

Conversation

robinbraemer
Copy link
Member

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.

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.
Copy link

cloudflare-workers-and-pages bot commented Jun 12, 2025

Deploying gate-minekube with  Cloudflare Pages  Cloudflare Pages

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

View logs

@robinbraemer robinbraemer requested a review from Copilot June 12, 2025 09:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@robinbraemer robinbraemer merged commit 322916a into master Jun 13, 2025
7 checks passed
@robinbraemer robinbraemer deleted the fix/issue-539 branch June 13, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: PreviousServer is always nil
1 participant