Use negotiatetimeout and connecttimeout as mutual defaults.
There is some confusion about when to use negotiatetimeout and when
to use connecttimeout. This should aleviate the problem a little
by using one as the default for the other. So if one is set, it will
become the value for both with the normal global/per-virtual scoping
rules honoured.
As suggested by Tuomo Soini
Another option is to combine negotiatetimeout and connecttimeout into
a single timeout, which I am happy to consider at a later date.
Signed-off-by: Simon Horman <[EMAIL PROTECTED]>
Index: heartbeat/ldirectord/ldirectord.in
===================================================================
--- heartbeat.orig/ldirectord/ldirectord.in 2007-07-04 14:51:43.000000000
+0900
+++ heartbeat/ldirectord/ldirectord.in 2007-07-04 15:01:05.000000000 +0900
@@ -117,6 +117,11 @@ real server is declared dead.
If defined in a virtual server section then the global value is overridden.
+If undefined then the value of negotiatetimeout is used. negotiatetimeout
+is also a global value that may be overriden by a per-virtual setting.
+
+If both checktimeout and negotiatetimeout are unset, the default is used.
+
Default: 5 seconds
B<negotiatetimeout = >I<n>
@@ -125,6 +130,11 @@ Timeout in seconds for negotiate checks.
If defined in a virtual server section then the global value is overridden.
+If undefined then the value of connecttimeout is used. connecttimeout is
+also a global value that may be overriden by a per-virtual setting.
+
+If both negotiatetimeout and connecttimeout are unset, the default is used.
+
Default: defined by the operating system
B<checkinterval = >I<n>
@@ -517,8 +527,10 @@ use vars qw(
$LDIRECTORD
$LDIRLOG
$NEGOTIATETIMEOUT
+ $DEFAULT_NEGOTIATETIMEOUT
$RUNPID
$CHECKTIMEOUT
+ $DEFAULT_CHECKTIMEOUT
$CHECKCOUNT
$QUIESCENT
$EMAILALERT
@@ -571,14 +583,16 @@ $DAEMON_TERM = undef;
$DAEMON_HUP = undef;
$AUTOCHECK = "no";
$CHECKINTERVAL = 10;
-$CHECKTIMEOUT = 5;
+$DEFAULT_CHECKTIMEOUT = 5;
+$CHECKTIMEOUT = -1;
$CHECKCOUNT = 1;
$LDIRECTORD = ld_find_cmd("ldirectord", 1);
if (! defined $LDIRECTORD) {
$LDIRECTORD = "@sbindir@/ldirectord";
}
$LDIRLOG = "/var/log/ldirectord.log";
-$NEGOTIATETIMEOUT = 0;
+$NEGOTIATETIMEOUT = -1;
+$DEFAULT_NEGOTIATETIMEOUT = 0;
$RUNPID = "/var/run/ldirectord";
$SUPERVISED = "no";
$QUIESCENT = "yes";
@@ -1743,15 +1757,41 @@ sub ld_setup
$$r{num_connects} = -1;
}
}
- if ($$v{checktimeout} < 0) {
- $$v{checktimeout} = $CHECKTIMEOUT;
+
+ # checktimeout and negotiate timeout are
+ # mutual defaults for each other, so calculate
+ # checktimeout in a tempoary variable so as not
+ # to affect the calculation of negotiatetimeout.
+
+ my $checktimeout = $$v{checktimeout};
+ if ($checktimeout < 0) {
+ $checktimeout = $$v{negotiatetimeout};
+ }
+ if ($checktimeout < 0) {
+ $checktimeout = $CHECKTIMEOUT;
+ }
+ if ($checktimeout < 0) {
+ $checktimeout = $NEGOTIATETIMEOUT;
+ }
+ if ($checktimeout < 0) {
+ $checktimeout = $DEFAULT_CHECKTIMEOUT;
+ }
+
+ if ($$v{negotiatetimeout} < 0) {
+ $$v{negotiatetimeout} = $$v{checktimeout};
}
if ($$v{negotiatetimeout} < 0) {
$$v{negotiatetimeout} = $NEGOTIATETIMEOUT;
}
if ($$v{negotiatetimeout} < 0) {
- $$v{negotiatetimeout} = $$v{checktimeout};
+ $$v{negotiatetimeout} = $CHECKTIMEOUT;
}
+ if ($$v{negotiatetimeout} < 0) {
+ $$v{negotiatetimeout} = $DEFAULT_NEGOTIATETIMEOUT;
+ }
+
+ $$v{checktimeout} = $checktimeout;
+
if ($$v{checkcount} < 0) {
$$v{checkcount} = $CHECKCOUNT;
}
--
--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/