Close Socket then catch excepstion

This commit is contained in:
Marko Oldenburg 2022-03-31 14:56:38 +02:00
parent abd1eacf7a
commit d9c6a10dc2
2 changed files with 8 additions and 4 deletions

View File

@ -1,2 +1,2 @@
UPD 2022-03-29_08:00:00 18968 FHEM/82_LGTV_WebOS.pm UPD 2022-03-31_06:48:33 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-31_06:22:06 55075 lib/FHEM/Devices/LGTV/LGTVWebOS.pm UPD 2022-03-31_14:55:57 55129 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -710,9 +710,11 @@ sub Write {
} }
catch { catch {
if ( $_->isa('autodie::exception') && $_->matches(':io') ) { if ( $_->isa('autodie::exception') && $_->matches(':io') ) {
::Log3( $name, 2, ::Log3( $name, 4,
"LGTV_WebOS ($name) - can't write to socket, autodie exception: $_" "LGTV_WebOS ($name) - can't write to socket, autodie exception: $_"
); );
Close($hash);
return; return;
} }
else { else {
@ -759,9 +761,11 @@ sub Read {
} }
catch { catch {
if ( $_->isa('autodie::exception') && $_->matches(':io') ) { if ( $_->isa('autodie::exception') && $_->matches(':io') ) {
::Log3( $name, 2, ::Log3( $name, 4,
"LGTV_WebOS ($name) - can't read from socket, autodie exception: $_" "LGTV_WebOS ($name) - can't read from socket, autodie exception: $_"
); );
Close($hash);
return; return;
} }
else { else {