summaryrefslogtreecommitdiff
path: root/src/lbdata.cc
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-27 17:51:34 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-07-27 17:51:34 -0700
commitfe6f0901ab0970bcc937328e6093f5b0f118230d (patch)
tree7f65d496da6a496ef5383075f164e7d71f7a760d /src/lbdata.cc
parentb80e518d20d05646404a28c2a5cbfc86d0221600 (diff)
downloadvyatta-wanloadbalance-fe6f0901ab0970bcc937328e6093f5b0f118230d.tar.gz
vyatta-wanloadbalance-fe6f0901ab0970bcc937328e6093f5b0f118230d.zip
fix bug in failed test completion.
Diffstat (limited to 'src/lbdata.cc')
-rw-r--r--src/lbdata.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lbdata.cc b/src/lbdata.cc
index 9aa155e..dffd422 100644
--- a/src/lbdata.cc
+++ b/src/lbdata.cc
@@ -70,6 +70,7 @@ LBHealth::start_new_test_cycle()
{
_test_iter = _test_coll.begin();
_test_success = false;
+ _new_test = true;
}
/**
@@ -82,12 +83,15 @@ LBHealth::send_test()
if (_test_success == true || _test_iter == _test_coll.end()) {
return; //means we are done
}
- _test_iter->second->init();
- _test_iter->second->send(*this);
-
- struct sysinfo si;
- sysinfo(&si);
- _time_start = si.uptime;
+ if (_new_test == true) {
+ _test_iter->second->init();
+ _test_iter->second->send(*this);
+
+ struct sysinfo si;
+ sysinfo(&si);
+ _time_start = si.uptime;
+ _new_test = false;
+ }
}
/**
@@ -102,6 +106,11 @@ LBHealth::recv_test()
return 0; //means stop iteration
}
+ if (_test_iter == _test_coll.end()) {
+ put(-1);
+ return 0; //means stop iteration
+ }
+
int rtt = _test_iter->second->recv(*this);
if (rtt > -1) {
_test_success = true;
@@ -114,6 +123,7 @@ LBHealth::recv_test()
unsigned long cur_time = si.uptime;
if (cur_time > _time_start + _timeout) {
//move to next test
+ _new_test = true;
++_test_iter;
}