Skip to content
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

PR, Palworld Support (Tested on Minecraft and PalWorld) #57

Merged
merged 7 commits into from
Feb 17, 2024

Conversation

ExusAltimus
Copy link
Contributor

@ExusAltimus ExusAltimus commented Jan 30, 2024

Fixes #56

Updated the RCONPacket to use gorcon's implementation (https://github.com/gorcon/rcon/blob/master/packet.go).
This fixed the issues I was having with authentication, I suppose it should work with other servers since gorcon claims support with several.

Also added a parameter to RCON called strictCommandPacketIdMatching (default: true) which when enabled matches the command to the response packet (This was the existing behavior).

When set to false the command instead behaves as a queue and any response will complete the command taskSource.
This is because PalWorld always returns 0 for the response packet id (bad).

…com/gorcon/rcon) (Fixes auth issues, untested on other servers besides pal world).

Added strictCommandPacketIdMatching parameter to RCON constructor. PalWorld does not respect packet id's (Always returns 0) so this was added to ignore the packet ids and match to the most recently sent command instead.  Default is true.
@ExusAltimus ExusAltimus changed the title PR, Palworld Support (UNTESTED ON OTHER SERVERS) PR, Palworld Support (Tested on Minecraft and PalWorld) Jan 30, 2024
@ExusAltimus
Copy link
Contributor Author

Just tested on a MC server just and it works.

image

Copy link
Contributor

@xobust xobust left a comment

Choose a reason for hiding this comment

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

Hi thanks for the contribution.

There was a lot of magic constants in the new implementation of RCON Packet.
I can see that there might be a bug where the buffer size is off by one resulting in a missing null pad.

For the strictCommandPacketIdMatching, does the server guarantee request response order? Or should the concurrent request be limited to 1. Even though the implementation is flawed I agree we could add this as an option.

src/CoreRCON/PacketFormats/RCONPacket.cs Outdated Show resolved Hide resolved
src/CoreRCON/Constants.cs Show resolved Hide resolved
src/CoreRCON/Constants.cs Outdated Show resolved Hide resolved
src/CoreRCON/PacketFormats/RCONPacket.cs Outdated Show resolved Hide resolved
src/CoreRCON/RCON.cs Outdated Show resolved Hide resolved
xobust added a commit that referenced this pull request Jan 30, 2024
Thanks @ExusAltimus
Partial-Fix: #56
Discovered-in: #57
Copy link
Contributor

@xobust xobust left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Can merge if your rebase in master and fix the comments.

src/CoreRCON/RCON.cs Outdated Show resolved Hide resolved
src/CoreRCON/RCON.cs Outdated Show resolved Hide resolved
src/CoreRCON/RCON.cs Outdated Show resolved Hide resolved
Exus Altimus added 3 commits January 31, 2024 05:22
…ad lock (TaskCompletionSource.SetResult) when server drops connection. Validated multithreaded operation. Updated shell. Added keep alive packets.
Copy link
Contributor Author

@ExusAltimus ExusAltimus left a comment

Choose a reason for hiding this comment

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

Updated the PR with requested changes, also added autoConnect property because PalWorld RCON implementation sucks so it drops the connection about every 20 seconds when a command isnt sent (I verified it wasn't related to RequestTimeout). PalWorld routinely kills the connection which lead to other issues I encountered such as a deadlock with the authentation task when attempting to use the same RCON instance and reconnect (The reader never flushed). Exposed 2 properties Authenticated and Connected, and a method SetPassword. The new version feels very stable on PalWorld even though its dropping the connection. Tested on minecraft, was able to kill the server, restart it and use the same RCON instance without needing to call ConnectAsync again.

@ExusAltimus
Copy link
Contributor Author

Also forgive me but I dont contribute often, what do you mean by "Can merge if your rebase in master"

Copy link
Contributor

@xobust xobust left a comment

Choose a reason for hiding this comment

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

Sorry for my late reponse.

I really like the changes in the PR.
I am doubtful about the need for the Cancellation token though.

src/CoreRCON/Extensions.cs Show resolved Hide resolved
src/CoreRCON/RCON.cs Show resolved Hide resolved
src/CoreRCON/RCON.cs Outdated Show resolved Hide resolved
@xobust
Copy link
Contributor

xobust commented Feb 7, 2024

To make the branch mergeable you need to merge or rebase it with master you can run this command:
git pull [email protected]:Challengermode/CoreRcon.git
And then solve all conflicts with a merge editor like vscode.

@ExusAltimus
Copy link
Contributor Author

Thank you, I applied the changes you requested, I also merged changes from main

@ExusAltimus
Copy link
Contributor Author

I've been successfully using the RCON for palworld for about a week now, palworld auto disconnects the RCON every 20 seconds but autoconnect lets me reuse the same instance without issues

image

Copy link
Contributor

@xobust xobust left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Trekkan
Copy link

Trekkan commented Feb 11, 2024

Can we get this merged? Thanks for everyone's work!

@xobust xobust merged commit 2860ede into Challengermode:master Feb 17, 2024
@xobust
Copy link
Contributor

xobust commented Feb 18, 2024

Hey sorry for the delay the new version should be up shortly.
Thanks for your contribution :)
https://www.nuget.org/packages/CoreRCON/5.4.0

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.

Auth failure when attempting to connect to a Palworld server.
3 participants