X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FIRC%2FSchedulers.pl;h=bf254ba6c6d46f85b2d92a68a8678df98bde668b;hb=f7cae48a17d6decd0a9bd997188271daa0a885b1;hp=44b021feb625be3b52b2c6d988217720f7deca9d;hpb=120cfa40c00f7ab27e4b08f3822da8f237b1d263;p=infobot.git diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index 44b021f..bf254ba 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -399,7 +399,7 @@ sub chanlimitCheck { } if (defined $limit and scalar keys %{ $channels{$chan}{''} } > $limit) { - &FIXME("LIMIT: set too low!!! FIXME"); + &FIXME("LIMIT: set too low!!!"); ### run NAMES again and flush it. } @@ -678,18 +678,14 @@ sub ircCheck { my $iconf = scalar( @x ); my $inow = scalar( keys %channels ); if ($iconf > 2 and $inow * 2 <= $iconf) { - &FIXME("ircCheck: current channels * 2 <= config channels. FIXME."); - &FIXME("ircCheck: iconf = $iconf"); - &FIXME("ircCheck: inow = $inow"); + &FIXME("ircCheck: current channels ($inow) * 2 <= config channels ($iconf)."); # @joinchan = @x; &joinNextChan(); } - # debug. needed for testing - &TODO("conn->connected = " . $conn->connected()); - &TODO("time()-msgtime = " . time() - $msgtime); + # todo: fix on_disconnect() - if (!$conn->connected or time() - $msgtime > 3600) { + if (time() - $msgtime > 3600) { # todo: shouldn't we use cache{connect} somewhere? if (exists $cache{connect}) { &WARN("ircCheck: no msg for 3600 and disco'd! reconnecting!"); @@ -765,14 +761,18 @@ sub miscCheck { my ($shmid, $size) = ($2,$5); next unless ($shmid != $shm and $size == 2000); my $z = &shmRead($shmid); - # TODO - add nick to SHM so multiple instances can be running - # as the same unix user on the same host? - if ($z =~ /^(\d+): /) { - my $time = $1; + if ($z =~ /^(\S+):(\d+):(\d+): /) { + my $n = $1; + my $pid = $2; + my $time = $3; next if (time() - $time < 60*60); + # FIXME remove not-pid shm if parent process dead + next if ($pid == $bot_pid); + # don't touch other bots, if they're running. + next unless ($param{ircNick} =~ /^\Q$n\E$/); } else { -# &DEBUG("shm: $shmid is not ours or old blootbot => ($z)"); -# next; + &DEBUG("shm: $shmid is not ours or old blootbot => ($z)"); + next; } &status("SHM: nuking shmid $shmid"); @@ -1012,7 +1012,7 @@ sub factoidCheck { my $time = time(); foreach (@list) { - my $age = &getFactInfo($_, "modified_time"); + my $age = &getFactInfo($_, "modified_time"); if (!defined $age or $age !~ /^\d+$/) { if (scalar @list > 50) {