Fix a number of duh's in new code

git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@446 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-06-22 18:56:58 +00:00
parent bc3f52a380
commit be6b0e203c

View File

@ -116,7 +116,7 @@ sub AddTimer {
my ($secs, $coderef) = @_; my ($secs, $coderef) = @_;
my $timeout = time + $secs; my $timeout = time + $secs;
if (!@Timers || ($timeout > $Timers[-1][0])) { if (!@Timers || ($timeout >= $Timers[-1][0])) {
push @Timers, [$timeout, $coderef]; push @Timers, [$timeout, $coderef];
return; return;
} }
@ -275,9 +275,18 @@ sub EpollEventLoop {
my @events; my @events;
my $i; my $i;
my $evcount; my $evcount = epoll_wait($Epoll, 1000, $timeout * 1000, \@events);
# get up to 1000 events, 1000ms timeout
while ($evcount = epoll_wait($Epoll, 1000, $timeout * 1000, \@events)) { if (!$evcount) {
foreach my $fd ( keys %DescriptorMap ) {
my Danga::Socket $sock = $DescriptorMap{$fd};
if ($sock->can('ticker')) {
$sock->ticker;
}
}
next;
}
my @objs; my @objs;
EVENT: EVENT:
for ($i=0; $i<$evcount; $i++) { for ($i=0; $i<$evcount; $i++) {
@ -315,19 +324,6 @@ sub EpollEventLoop {
} }
return unless PostEventLoop(); return unless PostEventLoop();
}
foreach my $fd ( keys %DescriptorMap ) {
my Danga::Socket $sock = $DescriptorMap{$fd};
if ($sock->can('ticker')) {
$sock->ticker;
}
}
return unless PostEventLoop();
print STDERR "Event loop ending; restarting.\n";
} }
exit 0; exit 0;
} }