X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.cc;h=7f3a2d1eda5947444f60a7e23392e893c7642b26;hb=bb98ce33936edc0dc914652c0227f95727518b16;hp=522120be3e3f6c79081a49687c3cab368d502866;hpb=9e2f8bdc3a3a5606d6e8010c9baeff11e63ee1bd;p=awesomized%2Flibmemcached diff --git a/libtest/server.cc b/libtest/server.cc index 522120be..7f3a2d1e 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -124,14 +124,13 @@ Server::Server(const std::string& host_arg, const in_port_t port_arg, Server::~Server() { - murder(); + kill(); } bool Server::check() { _app.slurp(); - _app.check(); - return true; + return _app.check(); } bool Server::validate() @@ -148,7 +147,7 @@ bool Server::cycle() while (--limit and is_pid_valid(_app.pid())) { - if (murder()) + if (kill()) { Log << "Killed existing server," << *this; dream(0, 50000); @@ -173,6 +172,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 +196,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); @@ -498,7 +505,7 @@ bool Server::args(Application& app) return true; } -bool Server::murder() +bool Server::kill() { if (check_pid(_app.pid())) // If we kill it, reset {