X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FIRC%2FSchedulers.pl;h=08be4a966ed64b57395d8334f68a49169d6f3113;hb=fd9fe8e75d8836fa55a52edd1af13df8e5bfafca;hp=e1646dae42d7381fb9958f69361ae9f293826154;hpb=bb649a773143b6ef36b369a2e0a3ca21bc7e0dc0;p=infobot.git diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index e1646da..08be4a9 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -686,11 +686,8 @@ sub ircCheck { } # debug. needed for testing - open(OUT, ">>irccheck.log"); - my $t = scalar(localtime); - printf OUT "%s: conn->connected = %s\n", $t, $conn->connected(); - printf OUT "%s: time()-msgtime = %d\n", $t, time() - $msgtime; - close OUT; + &TODO("conn->connected = " . scalar($conn->connected())); + &TODO("time()-msgtime = " . scalar(time() - $msgtime)); if (!$conn->connected or time() - $msgtime > 3600) { # todo: shouldn't we use cache{connect} somewhere? @@ -768,10 +765,15 @@ sub miscCheck { my ($shmid, $size) = ($2,$5); next unless ($shmid != $shm and $size == 2000); my $z = &shmRead($shmid); - 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;