2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-02 06:55:26 +00:00

FHEMWEB/fhem.pl: alarmTimeout. Forum #25504

git-svn-id: https://svn.fhem.de/fhem/trunk@6387 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-08-10 11:55:40 +00:00
parent 660c8c3b26
commit 647d23f41c
2 changed files with 7 additions and 2 deletions

View File

@ -128,6 +128,7 @@ FHEMWEB_Initialize($)
JavaScripts
SVGcache:1,0
addStateEvent
alarmTimeout
allowedCommands
allowfrom
basicAuth
@ -246,7 +247,9 @@ FW_Read($)
my $name = $hash->{NAME};
if($hash->{SERVERSOCKET}) { # Accept and create a child
TcpServer_Accept($hash, "FHEMWEB");
my $nhash = TcpServer_Accept($hash, "FHEMWEB");
my $wt = AttrVal($name, "alarmTimeout", undef);
$nhash->{ALARMTIMEOUT} = $wt if($wt);
return;
}

View File

@ -602,7 +602,9 @@ while (1) {
} else {
my $wb = $hash->{$wbName};
alarm($hash->{ALARMTIMEOUT}) if($hash->{ALARMTIMEOUT});
my $ret = syswrite($hash->{CD}, $wb);
alarm(0) if($hash->{ALARMTIMEOUT});
if(!$ret || $ret < 0) {
Log 4, "Write error to $p, deleting $hash->{NAME}";
TcpServer_Close($hash);
@ -2557,7 +2559,7 @@ SignalHandling()
$SIG{'PIPE'} = 'IGNORE';
$SIG{'CHLD'} = 'IGNORE';
$SIG{'HUP'} = sub { CommandRereadCfg(undef, "") };
$SIG{'ALRM'} = sub { Log 1, "ALARM signal, blocking write?" };
}
}