diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-03-23 15:22:01 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-03-23 15:22:01 -0700 |
commit | 2e5982e8d48b6893cdbd785be21da54515ea78d7 (patch) | |
tree | ba9a7c6fc3edc06e4dd22244de87fc923ac8c366 /src/lbtest.cc | |
parent | 62cf04bb7b19058fe2490ca6cd821273da56b67d (diff) | |
download | vyatta-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/lbtest.cc')
-rw-r--r-- | src/lbtest.cc | 9 |
1 files changed, 7 insertions, 2 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; |