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
This commit is contained in:
Matt Sergeant 2005-05-23 12:59:57 +00:00
parent ec9ddc09d2
commit 3b9c5b69fd

View File

@ -374,15 +374,16 @@ sub PostEventLoop {
@ToClose = (); @ToClose = ();
# now we're at the very end, call per-connection callbacks if defined # 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) { 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 # now we're at the very end, call global callback if defined
if (defined $PostLoopCallback) { if (defined $PostLoopCallback) {
return $PostLoopCallback->(\%DescriptorMap, \%OtherFds); $ret &&= $PostLoopCallback->(\%DescriptorMap, \%OtherFds);
} }
return 1; return $ret;
} }
@ -817,7 +818,7 @@ sub SetPostLoopCallback {
sub DESTROY { sub DESTROY {
my Danga::Socket $self = shift; my Danga::Socket $self = shift;
delete $PLCMap{$self->{fd}}; $self->close() if !$self->{closed};
} }
##################################################################### #####################################################################