diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-05-11 19:33:00 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-05-11 19:33:00 +0000 |
commit | 11d5079ca3c88977f9866a36b41796647ae2206c (patch) | |
tree | 2ab75209bc42e73bdda6746bbd0f3be04df22569 | |
parent | 981c62f7ebd870f258a02c8438d7f98e5a169a30 (diff) |
Clean up and shut down in correct order.
-rw-r--r-- | config/src/tests/failover/failover.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/config/src/tests/failover/failover.cpp b/config/src/tests/failover/failover.cpp index 7e7017ff057..d05c948b5d6 100644 --- a/config/src/tests/failover/failover.cpp +++ b/config/src/tests/failover/failover.cpp @@ -30,11 +30,10 @@ const vespalib::string requestTypes = "s"; const vespalib::string responseTypes = "sx"; struct RPCServer : public FRT_Invokable { - FRT_Supervisor * supervisor; vespalib::Barrier barrier; int64_t gen; - RPCServer() : supervisor(nullptr), barrier(2), gen(1) { } + RPCServer() : barrier(2), gen(1) { } void init(FRT_Supervisor * s) { FRT_ReflectionBuilder rb(s); @@ -87,14 +86,12 @@ void verifyConfig(std::unique_ptr<MyConfig> config) struct ServerFixture { using UP = std::unique_ptr<ServerFixture>; - std::unique_ptr<fnet::frt::StandaloneFRT> frtServer; - FRT_Supervisor * supervisor; + std::unique_ptr<fnet::frt::StandaloneFRT> frt; RPCServer server; Barrier b; const vespalib::string listenSpec; ServerFixture(const vespalib::string & ls) - : frtServer(), - supervisor(nullptr), + : frt(), server(), b(2), listenSpec(ls) @@ -108,10 +105,9 @@ struct ServerFixture { void start() { - frtServer = std::make_unique<fnet::frt::StandaloneFRT>(); - supervisor = & frtServer->supervisor(); - server.init(supervisor); - supervisor->Listen(get_port(listenSpec)); + frt = std::make_unique<fnet::frt::StandaloneFRT>(); + server.init(&frt->supervisor()); + frt->supervisor().Listen(get_port(listenSpec)); wait(); // Wait until test runner signals we can start wait(); // Signalling that we have shut down wait(); // Wait for signal saying that supervisor is deleted @@ -119,10 +115,9 @@ struct ServerFixture { void stop() { - if (frtServer) { + if (frt) { + frt.reset(); wait(); // Wait for supervisor to shut down - frtServer.reset(); - supervisor = nullptr; wait(); // Signal that we are done and start can return. } } |