summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2007-12-27 15:34:08 +0000
committeretienne2007-12-27 15:34:08 +0000
commit4df04911e0c1bb4abc7a816e4292ffa8b184e17b (patch)
treef01106ac70699c1c6e5d4a28104d43adb97d181f
parentef11349956f2cda28a513b32e4da8947e60d3568 (diff)
downloadivycontrolpanel-4df04911e0c1bb4abc7a816e4292ffa8b184e17b.zip
ivycontrolpanel-4df04911e0c1bb4abc7a816e4292ffa8b184e17b.tar.gz
ivycontrolpanel-4df04911e0c1bb4abc7a816e4292ffa8b184e17b.tar.bz2
ivycontrolpanel-4df04911e0c1bb4abc7a816e4292ffa8b184e17b.tar.xz
-rw-r--r--src/Agent.pm25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/Agent.pm b/src/Agent.pm
index 740d58e..de46360 100644
--- a/src/Agent.pm
+++ b/src/Agent.pm
@@ -12,15 +12,15 @@ use strict;
#
#----------------------------------------------------------------------
my ($x0, $y0, $wmax, $dx, $dy, $cmin, $rmax, @matrix, @hosts, $tempo_id,
- $mw, $bg, $fg, $selcolor, $pbcolor, $hlbg, $darkbg, $fontspec, @fontspec,
- $on_img, $off_img, $pb_img, %instances, @instances, $bus, $coef,
+ $mw, $bg, $fg, $selcolor, $pbcolor, $timeoutcolor, $hlbg, $darkbg, $fontspec, @fontspec,
+ $on_img, $off_img, $pb_img, $timeout_img, %instances, @instances, $bus, $coef,
$hosts_tl, $selected_host, $preselected_host, $pingThreshold);
# configure the class : graphic parameters, geometry and ivy bus
sub configure {
shift;
- ($mw, $bg, $fg, $selcolor, $pbcolor, $hlbg, $darkbg,
+ ($mw, $bg, $fg, $selcolor, $pbcolor, $timeoutcolor, $hlbg, $darkbg,
$fontspec, $x0, $y0, $wmax, $dy, $cmin, $rmax, $bus, $coef, $pingThreshold) = @_;
@fontspec = @$fontspec if $fontspec;
@@ -30,6 +30,8 @@ sub configure {
-foreground => $pbcolor);
$on_img = $mw->Bitmap('on', -file => Tk::findINC('led.bmp'),
-foreground => $selcolor);
+ $timeout_img = $mw->Bitmap('timeout', -file => Tk::findINC('led.bmp'),
+ -foreground => $timeoutcolor);
&_resetmatrix;
} # end configure
@@ -100,10 +102,14 @@ sub pingcb {
my ($class, $appname, $host, $pingtime) = @_;
#print "pingtime=$pingtime\n";
if ($instances{$appname}) {
- # if pingtime > $pingThreshold status is changed
- if ($pingtime > $pingThreshold) {
+ # pingtime < 0 means pong exceeded timeout
+ if ($pingtime == -1) {
+ $instances{$appname}->timeout;
+ # pingtime > $pingThreshold means pong exceeded threshold
+ } elsif ($pingtime > $pingThreshold) {
$instances{$appname}->pb;
- } elsif ($instances{$appname}->{status} == 2) {
+ # previous pbm detected
+ } elsif ($instances{$appname}->{status} >= 2) {
$instances{$appname}->nopb;
}
}
@@ -234,6 +240,13 @@ sub nopb {
} # end pb
+sub timeout {
+ my $self = shift;
+ $self->{status} = 3;
+ $self->{led}->configure(-image => $timeout_img);
+
+} # end timeout
+
# label placement
sub setposition {
my $self = shift;