X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver_container.cc;h=2179fd14f75446b05cc65983259f78c4f65c84f2;hb=bb98ce33936edc0dc914652c0227f95727518b16;hp=cc1e0a566b3409b7e0e0f05f4e534c52e1a570e1;hpb=9e2f8bdc3a3a5606d6e8010c9baeff11e63ee1bd;p=awesomized%2Flibmemcached diff --git a/libtest/server_container.cc b/libtest/server_container.cc index cc1e0a56..2179fd14 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -103,7 +103,7 @@ bool server_startup_st::shutdown(uint32_t host_to_shutdown) { Server* tmp= servers[host_to_shutdown]; - if (tmp and tmp->murder() == false) + if (tmp and tmp->kill() == false) { } else { @@ -139,7 +139,7 @@ bool server_startup_st::shutdown() bool success= true; for (std::vector::iterator iter= servers.begin(); iter != servers.end(); ++iter) { - if ((*iter)->has_pid() and (*iter)->murder() == false) + if ((*iter)->has_pid() and (*iter)->kill() == false) { Error << "Unable to kill:" << *(*iter); success= false; @@ -153,7 +153,12 @@ void server_startup_st::restart() { for (std::vector::iterator iter= servers.begin(); iter != servers.end(); ++iter) { - (*iter)->start(); + Server *server = *iter; + + if (server->check()) { + server->kill(); + } + server->start(); } } @@ -176,9 +181,9 @@ bool server_startup_st::validate() return _magic == MAGIC_MEMORY; } -bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[], const bool opt_startup_message) +bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, const char *argv[]) { - return construct.start_server(server_type, try_port, argc, argv, opt_startup_message); + return construct.start_server(server_type, try_port, argv); } libtest::Server* server_startup_st::create(const std::string& server_type, in_port_t try_port, const bool is_socket) @@ -215,9 +220,9 @@ libtest::Server* server_startup_st::create(const std::string& server_type, in_po } else if (server_type.compare("drizzled") == 0) { - if (DRIZZLED_BINARY) + if (has_drizzled()) { - if (HAVE_LIBDRIZZLE) + if (has_libdrizzle()) { server= build_drizzled("localhost", try_port); } @@ -225,8 +230,9 @@ libtest::Server* server_startup_st::create(const std::string& server_type, in_po } else if (server_type.compare("blobslap_worker") == 0) { - if (GEARMAND_BINARY) + if (has_gearmand()) { +#ifdef GEARMAND_BLOBSLAP_WORKER if (GEARMAND_BLOBSLAP_WORKER) { if (HAVE_LIBGEARMAN) @@ -234,11 +240,12 @@ libtest::Server* server_startup_st::create(const std::string& server_type, in_po server= build_blobslap_worker(try_port); } } +#endif // GEARMAND_BLOBSLAP_WORKER } } else if (server_type.compare("memcached") == 0) { - if (HAVE_MEMCACHED_BINARY) + if (has_memcached()) { server= build_memcached("localhost", try_port); } @@ -288,8 +295,7 @@ private: bool server_startup_st::_start_server(const bool is_socket, const std::string& server_type, in_port_t try_port, - int argc, const char *argv[], - const bool opt_startup_message) + const char *argv[]) { try { ServerPtr server(create(server_type, try_port, is_socket)); @@ -309,7 +315,7 @@ bool server_startup_st::_start_server(const bool is_socket, return false; } - server->build(argc, argv); + server->init(argv); #if 0 if (false) @@ -327,9 +333,8 @@ bool server_startup_st::_start_server(const bool is_socket, } else { - if (opt_startup_message) { -#if defined(DEBUG) +#ifdef DEBUG if (DEBUG) { Outn(); @@ -347,7 +352,7 @@ bool server_startup_st::_start_server(const bool is_socket, set_default_socket(server->socket().c_str()); } } - catch (libtest::disconnected& err) + catch (const libtest::disconnected& err) { if (fatal::is_disabled() == false and try_port != LIBTEST_FAIL_PORT) { @@ -355,12 +360,12 @@ bool server_startup_st::_start_server(const bool is_socket, return false; } } - catch (libtest::__test_result& err) + catch (const libtest::__test_result& err) { stream::cerr(err.file(), err.line(), err.func()) << err.what(); return false; } - catch (std::exception& err) + catch (const std::exception& err) { Error << err.what(); return false; @@ -374,18 +379,14 @@ bool server_startup_st::_start_server(const bool is_socket, return true; } -bool server_startup_st::start_server(const std::string& server_type, in_port_t try_port, - int argc, const char *argv[], - const bool opt_startup_message) +bool server_startup_st::start_server(const std::string& server_type, in_port_t try_port, const char *argv[]) { - return _start_server(false, server_type, try_port, argc, argv, opt_startup_message); + return _start_server(false, server_type, try_port, argv); } -bool server_startup_st::start_socket_server(const std::string& server_type, const in_port_t try_port, - int argc, const char *argv[], - const bool opt_startup_message) +bool server_startup_st::start_socket_server(const std::string& server_type, const in_port_t try_port, const char *argv[]) { - return _start_server(true, server_type, try_port, argc, argv, opt_startup_message); + return _start_server(true, server_type, try_port, argv); } std::string server_startup_st::option_string() const