From 1e64284c1348f89c1ba6e1f6beffb4f3608e926e Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Fri, 27 May 2011 21:48:04 +0000
Subject: [PATCH] Check connection status in the main loop and reconnect if the
 connection is lost.  Should fix current stupid behaviour.

---
 exec/ircbot.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/exec/ircbot.js b/exec/ircbot.js
index 8d2939fd54..b03005e261 100644
--- a/exec/ircbot.js
+++ b/exec/ircbot.js
@@ -204,6 +204,11 @@ function main() {
 		for (my_srv in Bot_Servers) {
 			var cmdline;
 			var srv = Bot_Servers[my_srv];
+
+			if(srv.sock && (!srv.sock.is_connected)) {
+				srv.sock.close();
+				src.sock=0;
+			}
 			if (!srv.sock &&(srv.lastcon <time())) { //we're not connected.
 				var consock = IRC_client_connect(srv.host, srv.nick,
 					srv.nick, real_name, srv.port);
-- 
GitLab