From: dms Date: Fri, 9 Feb 2001 13:18:15 +0000 (+0000) Subject: added debugging info to ircloop... if irc() does not return ever, we'll have to take... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c744961a70b94b3802e506964be31011fa77a6cc;p=infobot.git added debugging info to ircloop... if irc() does not return ever, we'll have to take another approach to do connect-next-server-if-cant-connect git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@368 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/IRC/Irc.pl b/src/IRC/Irc.pl index 909da29..d1958ae 100644 --- a/src/IRC/Irc.pl +++ b/src/IRC/Irc.pl @@ -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 {