From: dms Date: Sat, 15 Dec 2001 12:59:05 +0000 (+0000) Subject: - kill fork if it has run for too long, and still exists! X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b633b70da75877265fa2c75bd552b1b5cb4ec2c9;p=infobot.git - kill fork if it has run for too long, and still exists! - typo in ignoreAdd; use makeHostMask. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@532 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Factoids/Core.pl b/src/Factoids/Core.pl index 5a473d4..d8d559a 100644 --- a/src/Factoids/Core.pl +++ b/src/Factoids/Core.pl @@ -178,7 +178,7 @@ sub FactoidStuff { # todo: make forget limit configurable. # todo: make forget ignore time configurable. if ($cache{forget}{$h} > 5) { - &ignoreAdd($mask{nuh}, "*", 3*24*60*60, "abuse of forget"); + &ignoreAdd(&makeHostMask($nuh), "*", 3*24*60*60, "abuse of forget"); &msg($who, "forget: Suck it!"); } } diff --git a/src/Misc.pl b/src/Misc.pl index c0e25dc..5e9bf14 100644 --- a/src/Misc.pl +++ b/src/Misc.pl @@ -475,6 +475,7 @@ sub makeHostMask { if ($host =~ s/^(\S+!\S+\@)//) { &DEBUG("mHM: detected nick!user\@ for host arg; fixing"); + &DEBUG("nu => $nu"); $nu = $1; } diff --git a/src/Shm.pl b/src/Shm.pl index 4d34170..6412e4d 100644 --- a/src/Shm.pl +++ b/src/Shm.pl @@ -96,8 +96,15 @@ sub addForked { next unless ($time > $forker_timeout); ### TODO: use &time2string()? - &WARN("Fork: looks like we lost '$_', executed $time ago."); - delete $forked{$_}; + &WARN("Fork: looks like we lost '$_', executed $time ago"); + + if ( -d "/proc/$forked{$name}{PID}") { + my $pid = $forked{$name}{PID}; + &status("Fork: killing $name ($pid)"); + kill 9, $pid; + } + + delete $forked{$name}; } my $count = 0;