2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

fhem.pl: fix asyncOuput if FD is closed (Forum #82062)

git-svn-id: https://svn.fhem.de/fhem/trunk@15842 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-01-10 21:07:52 +00:00
parent f76bd2329d
commit e91bde7b8e

View File

@ -1826,8 +1826,18 @@ asyncOutput($$)
{
my ($cl, $ret) = @_;
return undef if(!$cl || !$cl->{NAME});
$cl = $defs{$cl->{NAME}} if($defs{$cl->{NAME}}); # compatibility
return CallFn($cl->{NAME}, "AsyncOutputFn", $cl, $ret);
my $temporary;
if($defs{$cl->{NAME}}) {
$cl = $defs{$cl->{NAME}}; # Compatibility
} else {
$defs{$cl->{NAME}} = $cl; # timeconsuming answer: get fd ist already closed
$temporary = 1;
}
CallFn($cl->{NAME}, "AsyncOutputFn", $cl, $ret);
delete $defs{$cl->{NAME}} if($temporary);
return undef;
}
#####################################