summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-03-23 15:22:01 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-03-23 15:22:01 -0700
commit2e5982e8d48b6893cdbd785be21da54515ea78d7 (patch)
treeba9a7c6fc3edc06e4dd22244de87fc923ac8c366 /src
parent62cf04bb7b19058fe2490ca6cd821273da56b67d (diff)
downloadvyatta-wanloadbalance-2e5982e8d48b6893cdbd785be21da54515ea78d7.tar.gz
vyatta-wanloadbalance-2e5982e8d48b6893cdbd785be21da54515ea78d7.zip
when a test is not configured the response time window is incorrectly scaled into milliseconds, therefore without a configured test it is much more likely that a ping test
will fail. the work-around is to configure a test (response time is not required as the default value of 5 seconds will be used at this point).
Diffstat (limited to 'src')
-rw-r--r--src/lbtest.cc9
-rw-r--r--src/lbtest.hh2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lbtest.cc b/src/lbtest.cc
index 8dd2f24..a45d48f 100644
--- a/src/lbtest.cc
+++ b/src/lbtest.cc
@@ -185,8 +185,13 @@ LBTest::recv(LBHealth &health)
else {
secs = recv_time.tv_sec - send_time.tv_sec;
}
+
+ if (_debug) {
+ printf("LBTest::recv(): usecs: %d, secs: %d\n",msecs,secs);
+ }
+
//time in milliseconds below
- r_iter->second._rtt = abs(msecs) / 1000 + 1000 * secs;
+ r_iter->second._rtt = (abs(msecs) / 1000) + 1000 * secs;
--pending_result_ct;
}
}
@@ -201,7 +206,7 @@ LBTest::recv(LBHealth &health)
while (r_iter != _results.end()) {
if (r_iter->second._iface == health._interface) {
- if (r_iter->second._rtt < _resp_time && r_iter->second._rtt >= 0) {
+ if (r_iter->second._rtt >= 0 && r_iter->second._rtt < _resp_time) {
_state = LBTest::K_SUCCESS;
if (_debug) {
cout << "LBTest::recv(): success for " << r_iter->second._iface << " : " << r_iter->second._rtt << endl;
diff --git a/src/lbtest.hh b/src/lbtest.hh
index 1fc7f07..208adaa 100644
--- a/src/lbtest.hh
+++ b/src/lbtest.hh
@@ -41,7 +41,7 @@ public:
public:
LBTest(bool debug) :
_debug(debug),
- _resp_time(5),
+ _resp_time(5*1000),
_state(K_NONE)
{init();}