From e91bde7b8e68fa2c7616c11c5592667e633a7285 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 10 Jan 2018 21:07:52 +0000 Subject: [PATCH] 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 --- fhem/fhem.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index bb748053a..ec4f05e80 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -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; } #####################################