Merge pull request 'patch-closewontworkonfileno' (#10) from patch-closewontworkonfileno into dev

Reviewed-on: #10
This commit is contained in:
Marko Oldenburg 2022-03-31 06:46:29 +02:00
commit 31d6c5dea1
3 changed files with 38 additions and 5 deletions

View File

@ -368,7 +368,7 @@ __END__
],
"release_status": "stable",
"license": "GPL_2",
"version": "v3.6.2",
"version": "v3.6.5",
"author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
],

View File

@ -1,2 +1,2 @@
UPD 2022-03-13_11:13:55 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-13_11:13:52 54282 lib/FHEM/Devices/LGTV/LGTVWebOS.pm
UPD 2022-03-29_08:00:00 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-31_06:22:06 55075 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -704,7 +704,24 @@ sub Write {
unless ( $hash->{CD} );
::Log3( $name, 4, "LGTV_WebOS ($name) - $string" );
syswrite( $hash->{CD}, $string );
try {
syswrite( $hash->{CD}, $string );
}
catch {
if ( $_->isa('autodie::exception') && $_->matches(':io') ) {
::Log3( $name, 2,
"LGTV_WebOS ($name) - can't write to socket, autodie exception: $_"
);
return;
}
else {
::Log3( $name, 2,
"LGTV_WebOS ($name) - can't write to socket: $_" );
return;
}
};
return;
}
@ -736,7 +753,23 @@ sub Read {
$hash->{helper}->{lastResponse} =
int( ::gettimeofday() ); # Check Socket KeepAlive
$len = sysread( $hash->{CD}, $buf, 10240 );
try {
$len = sysread( $hash->{CD}, $buf, 10240 );
}
catch {
if ( $_->isa('autodie::exception') && $_->matches(':io') ) {
::Log3( $name, 2,
"LGTV_WebOS ($name) - can't read from socket, autodie exception: $_"
);
return;
}
else {
::Log3( $name, 2,
"LGTV_WebOS ($name) - can't read from socket: $_" );
return;
}
};
if ( !defined($len) || !$len ) {