diff options
author | root <root@ka-ata-killa.ourano.james.local> | 2021-05-28 19:47:21 +0100 |
---|---|---|
committer | root <root@ka-ata-killa.ourano.james.local> | 2021-05-28 19:47:21 +0100 |
commit | 9b51ae6f7cd5c6e3f480d446a186a46a5bab8bfa (patch) | |
tree | 3f414fc920adffdf14c71270a7bc8e42f00fd286 /heating-cgi/boiler_rx | |
parent | 4560c3d1250f0392ebbdde25ff72053046d72da5 (diff) | |
download | heating-9b51ae6f7cd5c6e3f480d446a186a46a5bab8bfa.tar.gz heating-9b51ae6f7cd5c6e3f480d446a186a46a5bab8bfa.tar.bz2 heating-9b51ae6f7cd5c6e3f480d446a186a46a5bab8bfa.zip |
fish
Diffstat (limited to 'heating-cgi/boiler_rx')
-rwxr-xr-x | heating-cgi/boiler_rx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/heating-cgi/boiler_rx b/heating-cgi/boiler_rx index 777b3ee..f794e1b 100755 --- a/heating-cgi/boiler_rx +++ b/heating-cgi/boiler_rx @@ -35,10 +35,19 @@ while (1) { my $nodata = 0; while ( ( not $telnet->eof ) and ( $nodata < $timeout ) ) { - my $line = $telnet->getline( Timeout => 1, Errmode => 'return' ); + my $line = undef; + eval { + local $SIG{ALRM} = sub { die 'Timed Out'; }; + alarm 2; + + $line = $telnet->getline( Timeout => 1, Errmode => 'return' ); + alarm 0; + }; + alarm 0; if ( not defined $line or ( length($line) == 0 ) ) { $nodata++; + next; } else { $nodata = 0; |