From 5a7bf68c8cac54a15ae169d81f3d1740e0127482 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Fri, 19 Jul 2019 20:54:44 +0200 Subject: [PATCH] SDK: Do not always stop the session on destruction --- fairmq/sdk/DDSSession.cxx | 6 ++---- fairmq/sdk/DDSSession.h | 1 + test/sdk/TopologyFixture.h | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fairmq/sdk/DDSSession.cxx b/fairmq/sdk/DDSSession.cxx index 991d1e08..e533d6b5 100644 --- a/fairmq/sdk/DDSSession.cxx +++ b/fairmq/sdk/DDSSession.cxx @@ -76,10 +76,6 @@ struct DDSSession::Impl } } - ~Impl() - { - fSession.shutdown(); - } struct Tag {}; friend auto operator<<(std::ostream& os, Tag) -> std::ostream& { return os << "DDSSession"; } tools::InstanceLimiter fCount; @@ -103,6 +99,8 @@ auto DDSSession::IsRunning() const -> bool { return fImpl->fSession.IsRunning(); auto DDSSession::GetId() const -> Id { return fImpl->fId; } +auto DDSSession::Stop() -> void { return fImpl->fSession.shutdown(); } + auto DDSSession::GetDefaultPlugin() const -> DDSRMSPlugin { return fImpl->fDefaultPlugin; } auto DDSSession::SubmitAgents(Quantity agents) -> void diff --git a/fairmq/sdk/DDSSession.h b/fairmq/sdk/DDSSession.h index 4265c434..25fa6657 100644 --- a/fairmq/sdk/DDSSession.h +++ b/fairmq/sdk/DDSSession.h @@ -61,6 +61,7 @@ class DDSSession auto SubmitAgents(Quantity agents, const Path& config) -> void; auto RequestAgentInfo() -> void; auto ActivateTopology(Path topologyFile) -> void; + auto Stop() -> void; friend auto operator<<(std::ostream& os, DDSSession session) -> std::ostream&; private: diff --git a/test/sdk/TopologyFixture.h b/test/sdk/TopologyFixture.h index 08f2516e..d1f7ebf5 100644 --- a/test/sdk/TopologyFixture.h +++ b/test/sdk/TopologyFixture.h @@ -61,11 +61,13 @@ struct TopologyFixture : ::testing::Test LOG(info) << mDDSEnv; LOG(info) << mDDSSession; mDDSSession.SubmitAgents(2); - std::this_thread::sleep_for(std::chrono::seconds(1)); + std::this_thread::sleep_for(std::chrono::seconds(1)); // TODO implement WaitForIdleAgents mDDSSession.ActivateTopology(mDDSTopologyFile); } - auto TearDown() -> void override {} + auto TearDown() -> void override { + mDDSSession.Stop(); + } LoggerConfig mLoggerConfig; std::string mDDSTopologyFile;