Fix SDK topology shutdown to include unsubscribe

This commit is contained in:
Alexey Rybalchenko 2019-07-23 14:30:01 +02:00 committed by Dennis Klein
parent 8789664cfd
commit be022cfab8
3 changed files with 7 additions and 0 deletions

View File

@ -234,6 +234,11 @@ void DDSSession::SubscribeToCommands(std::function<void(const std::string& msg,
// });
}
void DDSSession::UnsubscribeFromCommands()
{
fImpl->fDDSCustomCmd.unsubscribe();
}
void DDSSession::SendCommand(const std::string& cmd) { fImpl->fDDSCustomCmd.send(cmd, ""); }
auto operator<<(std::ostream& os, const DDSSession& session) -> std::ostream&

View File

@ -71,6 +71,7 @@ class DDSSession
void StartDDSService();
void SubscribeToCommands(std::function<void(const std::string& msg, const std::string& condition, uint64_t senderId)>);
void UnsubscribeFromCommands();
void SendCommand(const std::string&);
friend auto operator<<(std::ostream& os, const DDSSession& session) -> std::ostream&;

View File

@ -182,6 +182,7 @@ void Topology::AddNewStateEntry(uint64_t senderId, const std::string& state)
Topology::~Topology()
{
fDDSSession.UnsubscribeFromCommands();
{
std::lock_guard<std::mutex> guard(fMtx);
fShutdown = true;