summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorsecret_online <me+github@secretonline.co>2016-01-24 09:16:33 +1300
committersecret_online <me+github@secretonline.co>2016-01-24 09:16:33 +1300
commitf2833e5d964fb38d79805de3908f153a9314ee6c (patch)
tree4ffc5da71456265a4d5b505558bb9986123b7c89
parentBeautify with JS Beautify (diff)
downloadshulker-f2833e5d964fb38d79805de3908f153a9314ee6c.tar.gz
shulker-f2833e5d964fb38d79805de3908f153a9314ee6c.zip
Reconnect RCON on error
Added 10s delay inbetween connections
-rw-r--r--index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/index.js b/index.js
index aae741b..fba3da4 100644
--- a/index.js
+++ b/index.js
@@ -20,6 +20,11 @@ client.on("auth", function() {
     }
 }).on("end", function() {
     console.log("[INFO] Rcon closed!");
+}).on("error", function() {
+    client.disconnect();
+    setTimeout(function() {
+        client.connect();
+    }, 10000);
 });
 
 client.connect();