summaryrefslogtreecommitdiffstats
path: root/heating-cgi/boiler_rx
diff options
context:
space:
mode:
Diffstat (limited to 'heating-cgi/boiler_rx')
-rwxr-xr-xheating-cgi/boiler_rx11
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;