Open HimoriTempest opened 2 years ago
I am seeing the same error with a Conan Exiles server, pretty reliably, and may have made some progress:
The error appears to be in the packet ID, which are used in handlePacket
to identify the promise to resolve (if I'm reading the function right): https://github.com/janispritzkau/rcon-client/blob/master/src/rcon.ts#L187
My first test was to add a log statement and see if packets were being received at all, which they were:
handlePacket(data) {
const packet = packet_1.decodePacket(data);
const id = this.authenticated ? packet.id : this.requestId - 1;
console.log('handle packet', id, packet);
Would consistently log something like:
handle packet 0 {
id: 0,
type: 2,
payload: <Buffer ...>
}
[2022-12-15T14:40:54.967Z] INFO: conan-discord/2362421 on ssube-hx90: logged in and ready (user=gluebot#9846)
[2022-12-15T14:41:01.429Z] DEBUG: conan-discord/2362421 on ssube-hx90: message created (user=ssube#1092, text=conan-online)
[2022-12-15T14:41:01.429Z] DEBUG: conan-discord/2362421 on ssube-hx90: message matched command (command=conan-online)
handle packet 1 {
id: 0,
type: 2,
payload: <Buffer 49 64 ... many more bytes>
}
I'm not super familiar with the RCON protocol, but those show packet 0
with id: 0
and then packet 1
with another id: 0
. I suspect the game server may be ignoring/repeating packet IDs, and confusing the client.
To verify that, I tried fudging the ID in handlePacket
to be:
handlePacket(data) {
const packet = packet_1.decodePacket(data);
const id = this.authenticated ? (packet.id + 1) : this.requestId - 1; // note packet.id + 1
console.log('handle packet', id, packet);
I even checked the AST parse just in case and it should parse as this.authenticated ? (packet.id + 1) : (this.requestId - 1);
, so I'm not sure why the packet numbers are off, other than the game server using its own system.
With the packet.id + 1
fix, I'm not seeing any timeouts.
I can't directly point at what is causing it besides the fact that it always happens when a command opens a dialogue on the server. Here is the plugin used to create a rcon server: https://github.com/Jimmacle/torch-rcon-plugin
Full error message:
"error": { "message": "Timeout for packet id 1", "stack": "Error: Timeout for packet id 1\n at Timeout._onTimeout (/opt/node_modules/rcon-client/lib/rcon.js:117:28)\n at listOnTimeout (internal/timers.js:557:17)\n at processTimers (internal/timers.js:500:7)" }