adds handshake delay and test doneness check

This commit is contained in:
Peter Thorson
2012-06-05 08:26:06 -05:00
parent 1d3942622a
commit 2d12256c7c
3 changed files with 27 additions and 3 deletions

View File

@@ -94,6 +94,11 @@ void request::process(unsigned int id) {
boost::thread t(boost::bind(&client::run, &e, true));
size_t handshake_delay;
if(!wscmd::extract_number<size_t>(command, "handshake_delay",handshake_delay)) {
handshake_delay = 10;
}
// create connections
for (size_t i = 0; i < connection_count; i++) {
client::connection_ptr con;
@@ -103,6 +108,8 @@ void request::process(unsigned int id) {
shandler->on_connect(con);
e.connect(con);
boost::this_thread::sleep(boost::posix_time::milliseconds(handshake_delay));
}
for (;;) {
@@ -111,12 +118,18 @@ void request::process(unsigned int id) {
// check for too few connections
shandler->maintenance();
bool quit = shandler->maintenance();
// check for done-ness
if (quit) {
break;
}
sleep(1);
}
e.end_perpetual();
t.join();
}
writer->write(prepare_response("test_complete",""));