DDS plugin: fix exiting timeout

This commit is contained in:
Alexey Rybalchenko 2020-02-20 15:53:02 +01:00 committed by Dennis Klein
parent 21835cc104
commit beff0af51b
3 changed files with 5 additions and 4 deletions

View File

@ -92,6 +92,9 @@ DDS::DDS(const string& name,
break; break;
} }
case DeviceState::Exiting: case DeviceState::Exiting:
if (!fControllerThread.joinable()) {
fControllerThread = thread(&DDS::WaitForExitingAck, this);
}
fWorkGuard.reset(); fWorkGuard.reset();
fDeviceTerminationRequested = true; fDeviceTerminationRequested = true;
UnsubscribeFromDeviceStateChange(); UnsubscribeFromDeviceStateChange();
@ -358,9 +361,6 @@ auto DDS::SubscribeForCustomCommands() -> void
case cmd::Type::subscribe_to_state_change: { case cmd::Type::subscribe_to_state_change: {
lock_guard<mutex> lock{fStateChangeSubscriberMutex}; lock_guard<mutex> lock{fStateChangeSubscriberMutex};
fStateChangeSubscribers.insert(senderId); fStateChangeSubscribers.insert(senderId);
if (!fControllerThread.joinable()) {
fControllerThread = thread(&DDS::WaitForExitingAck, this);
}
LOG(debug) << "Publishing state-change: " << fLastState << "->" << fCurrentState LOG(debug) << "Publishing state-change: " << fLastState << "->" << fCurrentState
<< " to " << senderId; << " to " << senderId;

View File

@ -145,6 +145,7 @@ try {
unsigned int timeout; unsigned int timeout;
fair::Logger::SetConsoleSeverity("debug"); fair::Logger::SetConsoleSeverity("debug");
fair::Logger::SetConsoleColor(true);
bpo::options_description options("Common options"); bpo::options_description options("Common options");

View File

@ -238,7 +238,7 @@ class BasicTopology : public AsioBase<Executor, Allocator>
}); });
fDDSSession.StartDDSService(); fDDSSession.StartDDSService();
LOG(debug) << "Subscribing to state change"; // LOG(debug) << "Subscribing to state change";
Cmds cmds(make<SubscribeToStateChange>()); Cmds cmds(make<SubscribeToStateChange>());
fDDSSession.SendCommand(cmds.Serialize()); fDDSSession.SendCommand(cmds.Serialize());
} }