]> git.donarmstrong.com Git - infobot.git/commitdiff
added debugging info to ircloop... if irc() does not return ever, we'll have to take...
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 9 Feb 2001 13:18:15 +0000 (13:18 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 9 Feb 2001 13:18:15 +0000 (13:18 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@368 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/Irc.pl

index 909da29cfb81693e6849f63e37596fe7c6b6af2c..d1958ae7c46724e36be4001ef86f941ce0c9b0c5 100644 (file)
@@ -23,7 +23,8 @@ sub ircloop {
     my $error  = 0;
     my $lastrun = 0;
 
-    while (1) {
+loop:;
+    foreach (shift @ircServers) {
        # JUST IN CASE. irq was complaining about this.
        if ($lastrun == time()) {
            &DEBUG("hrm... lastrun == time()");
@@ -32,28 +33,34 @@ sub ircloop {
            next;
        }
 
-       foreach (@ircServers) {
-           if (!defined $_) {
-               &DEBUG("ircloop: ircServers[x] = NULL.");
-               $lastrun = time();
-               next;
-           }
-           next unless (exists $ircPort{$_});
+       if (!defined $_) {
+           &DEBUG("ircloop: ircServers[x] = NULL.");
+           $lastrun = time();
+           next;
+       }
+       next unless (exists $ircPort{$_});
 
-           my $retval = &irc($_, $ircPort{$_});
-           next unless (defined $retval and $retval == 0);
-           $error++;
-           if ($error % 3 == 0 and $error != 0) {
-               &ERROR("CANNOT connect to this server; next!");
-               next;
-           }
-
-           if ($error >= 3*3) {
-               &ERROR("CANNOT connect to any irc server; stopping.");
-               exit 1;
-           }
+       my $retval = &irc($_, $ircPort{$_});
+       &DEBUG("ircloop: after irc()");
+
+       next unless (defined $retval and $retval == 0);
+
+       $error++;
+
+       if ($error % 3 == 0 and $error != 0) {
+           &ERROR("CANNOT connect to this server; next!");
+           next;
+       }
+
+       if ($error >= 3*3) {
+           &ERROR("CANNOT connect to any irc server; stopping.");
+           exit 1;
        }
     }
+
+    &DEBUG("ircloop: end... going back.");
+    &loadIRCServers();
+    goto loop;
 }
 
 sub irc {