Mail-SMTP-Honeypot
view release on metacpan or search on metacpan
Honeypot.pm view on Meta::CPAN
# next => \&next thing to do
};
my($rin,$win,$rout,$wout,$delta,$nfound);
while($run) {
$win = $rin = '';
$threads->{$DNSfileno}->{read} = \&dns_rcv; # always armed
foreach(grep(!/\D/,keys %$threads)) { # each thread key
vec($rin,$_,1) = 1 if $threads->{$_}->{read}; # set read selects
vec($win,$_,1) = 1 if $threads->{$_}->{write}; # set write selects
}
$go_listen->{read} = \&newthread; # re-arm listner if it was busy
$nfound = select($rout=$rin,$wout=$win,undef,1); # tick each second
if ($nfound > 0) {
do_thread($wout,'write') if $wout;
do_thread($rout,'read') if $rout;
}
elsif ($delta = ($_ = time) - $then) { # timer = next second or more
$then = $_;
my @threads = keys %$threads;
foreach(@threads) { # each receive thread
( run in 0.258 second using v1.01-cache-2.11-cpan-87723dcf8b7 )