Fix race-condition in FRM_Poll if connection is unstable

git-svn-id: https://svn.fhem.de/fhem/trunk@3150 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess
2013-05-03 21:15:31 +00:00
parent 9cdf718278
commit 3d1d7be6ca

View File

@@ -461,7 +461,7 @@ sub FRM_poll
vec($rin, $hash->{FD}, 1) = 1;
my $nfound = select($rout=$rin, undef, undef, 0.1);
my $mfound = vec($rout, $hash->{FD}, 1);
if($mfound) {
if($mfound && defined $hash->{FirmataDevice}) {
$hash->{FirmataDevice}->poll();
}
return $mfound;
@@ -472,7 +472,7 @@ sub FRM_poll
if($po) {
($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags) = $po->status;
}
if ($InBytes && $InBytes>0) {
if ($InBytes && $InBytes>0 && defined $hash->{FirmataDevice}) {
$hash->{FirmataDevice}->poll();
}
}