2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

buxgfix: prevent fhem from stalling if telnet times out in 66_ECMD.pm

git-svn-id: https://svn.fhem.de/fhem/trunk@1070 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2011-10-13 17:08:50 +00:00
parent 9ede1c3311
commit 81740a9024
2 changed files with 11 additions and 1 deletions

View File

@ -10,6 +10,7 @@
- bugfix: FHEM2FHEM should work with CUL again, after syntax change - bugfix: FHEM2FHEM should work with CUL again, after syntax change
- feature: CUL directio mode (No Device::SerialPort needed) - feature: CUL directio mode (No Device::SerialPort needed)
- feature: FritzBox 7270 ZIP file - feature: FritzBox 7270 ZIP file
- buxgfix: prevent fhem from stalling if telnet times out in 66_ECMD.pm
- 2011-07-08 (5.1) - 2011-07-08 (5.1)
- feature: smallscreen optimizations for iPhone - feature: smallscreen optimizations for iPhone

View File

@ -149,7 +149,16 @@ ECMD_OpenDev($$)
return; return;
} }
my $conn = IO::Socket::INET->new(PeerAddr => $devicename); my $conn;
eval {
local $SIG{ALRM} = sub { die 'Timed Out'; };
alarm 10;
$conn = IO::Socket::INET->new(PeerAddr => $devicename, timeout => 5);
};
alarm 0;
$conn= undef if $@;
# return "Error: timeout." if ( $@ && $@ =~ /Timed Out/ );
# return "Error: Eval corrupted: $@" if $@;
if($conn) { if($conn) {
delete($hash->{NEXT_OPEN}) delete($hash->{NEXT_OPEN})