X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.cc;h=bfb265cdb5811520b22a45d0a689ac36e29f1a96;hb=cbec7a4b9613b8ae3807539fae3a29ed8aff4984;hp=044772f55cb6d3b275931a86d3247c6b5663768a;hpb=cefa0313d23c6ca1cfc54670cbf33906a398e58e;p=awesomized%2Flibmemcached diff --git a/libtest/server.cc b/libtest/server.cc index 044772f5..bfb265cd 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -129,9 +130,8 @@ Server::~Server() bool Server::check() { - _app.slurp(); - _app.check(); - return true; + _app.clear(); + return _app.check(); } bool Server::validate() @@ -173,6 +173,22 @@ bool Server::wait_for_pidfile() const return wait.successful(); } +bool Server::init(const char *argv[]) +{ + if (argv) + { + for (const char **ptr= argv; *ptr ; ++ptr) + { + if (ptr) + { + add_option(*ptr); + } + } + } + + return build(); +} + bool Server::has_pid() const { return (_app.pid() > 1); @@ -181,14 +197,6 @@ bool Server::has_pid() const bool Server::start() { - // If we find that we already have a pid then kill it. - if (has_pid() == true) - { -#if 0 - fatal_message("has_pid() failed, programer error"); -#endif - } - if (getenv("YATL_GDB_SERVER")) { _app.use_gdb(true); @@ -295,7 +303,9 @@ bool Server::start() if (pinged == false) { - Error << "ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " run:" << _running << " " << error(); +#if 0 + Error << "Failed to ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " run:" << _running << " " << error(); +#endif // If we happen to have a pid file, lets try to kill it if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0)) @@ -480,13 +490,16 @@ bool Server::args(Application& app) for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter) { - if ((*iter).second.empty() == false) + if ((*iter).first.empty() == false) { - app.add_option((*iter).first, (*iter).second); - } - else - { - app.add_option((*iter).first); + if ((*iter).second.empty() == false) + { + app.add_option((*iter).first, (*iter).second); + } + else + { + app.add_option((*iter).first); + } } }