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

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@1070 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
neubert
2011-10-13 17:08:50 +00:00
parent 98a01ffc5d
commit 38deba5a10
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
- feature: CUL directio mode (No Device::SerialPort needed)
- feature: FritzBox 7270 ZIP file
- buxgfix: prevent fhem from stalling if telnet times out in 66_ECMD.pm
- 2011-07-08 (5.1)
- feature: smallscreen optimizations for iPhone

View File

@@ -149,7 +149,16 @@ ECMD_OpenDev($$)
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) {
delete($hash->{NEXT_OPEN})