summary refs log tree commit diff homepage
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/index.js b/index.js
index 7a288f8..e034e9a 100644
--- a/index.js
+++ b/index.js
@@ -11,6 +11,7 @@ var debug = c.DEBUG;
 var shulker = new Discord.Client();
 
 var client = new Rcon(c.MINECRAFT_SERVER_RCON_IP, c.MINECRAFT_SERVER_RCON_PORT, c.MINECRAFT_SERVER_RCON_PASSWORD);
+var rconTimeout;
 
 client.on("auth", function() {
     console.log("[INFO] Authenticated with " + c.MINECRAFT_SERVER_RCON_IP + ":" + c.MINECRAFT_SERVER_RCON_PORT);
@@ -21,10 +22,13 @@ client.on("auth", function() {
 }).on("end", function() {
     console.log("[INFO] Rcon closed!");
 }).on("error", function() {
-    client.disconnect();
-    setTimeout(function() {
-        client.connect();
-    }, c.RCON_RECONNECT_DELAY * 1000);
+    if (typeof rconTimeout === 'undefined') {
+        client.disconnect();
+        rconTimeout = setTimeout(function() {
+            client.connect();
+            rconTimeout = undefined;
+        }, c.RCON_RECONNECT_DELAY * 1000);
+    }
 });
 
 client.connect();
='/cgit-pink/commit/ui-shared.h?id=e09574bdf6cfbd21ff0a58a18f34d4a11db824d7&follow=1'>cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt