X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=libtest%2Fserver_container.cc;h=79f0ad31d0ee647a686d148fd141ba1462a4177e;hb=23dca174eef8d846e3d4402729b57f6ded035e64;hp=0448e20900e2b847831a6f5c802a073e68eb9135;hpb=6278f4fcc2b81952d7420c081961dd83935c8c85;p=awesomized%2Flibmemcached diff --git a/libtest/server_container.cc b/libtest/server_container.cc index 0448e209..79f0ad31 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -34,7 +34,7 @@ * */ -#include +#include "mem_config.h" #include #include @@ -182,7 +182,7 @@ bool server_startup_st::validate() 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) { - construct.start_server(server_type, try_port, argc, argv, opt_startup_message); + return construct.start_server(server_type, try_port, argc, argv, opt_startup_message); } 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) @@ -274,7 +274,13 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Launching of an unknown server was attempted: %s", server_type.c_str()); } + } + catch (...) + { + throw; + } + try { /* We will now cycle the server we have created. */ @@ -296,20 +302,30 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t } else #endif + if (server->start() == false) + { + delete server; + return false; + } + else + { + if (opt_startup_message) + { + Outn(); + Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running(); + Outn(); + } + } + } + catch (libtest::disconnected& err) + { + if (fatal::is_disabled() == false and try_port != LIBTEST_FAIL_PORT) { + stream::cerr(err.file(), err.line(), err.func()) << err.what(); delete server; return false; } - else - { - if (opt_startup_message) - { - Outn(); - Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running(); - Outn(); - } - } } catch (...) {