From 3b9c5b69fd9b7d6aac8a1b6a8865d33f8e005b23 Mon Sep 17 00:00:00 2001 From: Matt Sergeant Date: Mon, 23 May 2005 12:59:57 +0000 Subject: [PATCH] Move PLC managment into close() and call close() in DESTROY git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@424 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Danga/Socket.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Danga/Socket.pm b/lib/Danga/Socket.pm index f91a974..331f357 100644 --- a/lib/Danga/Socket.pm +++ b/lib/Danga/Socket.pm @@ -374,15 +374,16 @@ sub PostEventLoop { @ToClose = (); # now we're at the very end, call per-connection callbacks if defined + my $ret = 1; # use $ret so's to not starve some FDs; return 0 if any PLCs return 0 for my $plc (values %PLCMap) { - return unless $plc->(\%DescriptorMap, \%OtherFds); + $ret &&= $plc->(\%DescriptorMap, \%OtherFds); } # now we're at the very end, call global callback if defined if (defined $PostLoopCallback) { - return $PostLoopCallback->(\%DescriptorMap, \%OtherFds); + $ret &&= $PostLoopCallback->(\%DescriptorMap, \%OtherFds); } - return 1; + return $ret; } @@ -817,7 +818,7 @@ sub SetPostLoopCallback { sub DESTROY { my Danga::Socket $self = shift; - delete $PLCMap{$self->{fd}}; + $self->close() if !$self->{closed}; } #####################################################################