From d66d22a9cdf4963d7a57482dda9e039e1ec0cf76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vest=C3=B8l?= Date: Fri, 5 Jul 2019 23:07:25 +0200 Subject: [PATCH 1/4] Updated rcon-client --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 51ee37db..9e8d861f 100644 --- a/package.json +++ b/package.json @@ -56,20 +56,20 @@ "node-factorio-api": "^0.3.1-alpha", "node-forge": "^0.7.1", "prom-client": "^10.2.3", - "rcon-client": "^3.0.2", + "rcon-client": "^3.1.6", "request": "^2.83.0", "right-pad": "^1.0.1", "rmdir-sync": "^1.0.1", "sanitizer": "^0.1.3", "simple-git": "^1.96.0", "single-line-log": "^1.1.2", + "snyk": "^1.134.2", "socket.io": "^2.0.4", "socket.io-client": "^2.0.4", "socket.io-prometheus": "^0.2.1", "sync-request": "^4.0.1", "typescript-collections": "^1.3.2", - "underscore": "^1.8.3", - "snyk": "^1.134.2" + "underscore": "^1.8.3" }, "devDependencies": { "documentation": "^5.4.0", From f35be2f355e3937a76c1c283157be3fd57ffa4dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vest=C3=B8l?= Date: Fri, 5 Jul 2019 23:42:51 +0200 Subject: [PATCH 2/4] Set max pending rcon requests to 1 --- client.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client.js b/client.js index aded5348..5c6222c7 100644 --- a/client.js +++ b/client.js @@ -364,12 +364,14 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n data = data.toString("utf8").replace(/(\r\n\t|\n|\r\t)/gm,""); console.log(data); if(data.includes("Starting RCON interface")){ - let client = new Rcon(); + let client = new Rcon({ + packetResponseTimeout: 2000, + maxPending: 1 + }); client.connect({ host: 'localhost', port: Number(process.env.RCONPORT) || instconf.clientPort, - password: instconf.clientPassword, - timeout: 5000 + password: instconf.clientPassword }); client.onDidAuthenticate(() => { console.log('Clusterio | RCON Authenticated!'); From a122f2b09e78a43e62fd87921c120be026010b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vest=C3=B8l?= Date: Sat, 6 Jul 2019 00:46:22 +0200 Subject: [PATCH 3/4] Increased rcon timeout to 20s, increased maxPending to 5 --- client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.js b/client.js index 5c6222c7..a0413bb3 100644 --- a/client.js +++ b/client.js @@ -365,8 +365,8 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n console.log(data); if(data.includes("Starting RCON interface")){ let client = new Rcon({ - packetResponseTimeout: 2000, - maxPending: 1 + packetResponseTimeout: 20000, + maxPending: 5 }); client.connect({ host: 'localhost', From 6c32271c56897c345ad0f5d377b8d46b24949504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vest=C3=B8l?= Date: Sat, 6 Jul 2019 12:44:31 +0200 Subject: [PATCH 4/4] Fixed rcon timeout in the right place, set to 200s for 1250kB commands --- client.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client.js b/client.js index a0413bb3..ce67a6a8 100644 --- a/client.js +++ b/client.js @@ -365,7 +365,7 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n console.log(data); if(data.includes("Starting RCON interface")){ let client = new Rcon({ - packetResponseTimeout: 20000, + packetResponseTimeout: 200000, maxPending: 5 }); client.connect({ @@ -495,8 +495,10 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n // connect to the server with rcon if(true || process.platform != "linux"){ // IP, port, password - client = new Rcon(); - + client = new Rcon({ + packetResponseTimeout: 200000, // 200s, should allow for commands up to 1250kB in length + maxPending: 5 + }); // check the logfile to see if the RCON interface is running as there is no way to continue without it // we read the log every 2 seconds and stop looping when we start connecting to factorio function checkRcon() { @@ -507,7 +509,6 @@ write-data=${ path.resolve(config.instanceDirectory, instance) }\r\n host: 'localhost', port: args["rcon-port"] || Number(process.env.RCONPORT) || instanceconfig.clientPort, password: args["rcon-password"] || instanceconfig.clientPassword, - timeout: 5000 }); } else { setTimeout(function(){