diff --git a/smocore/deviceManager/deviceReattacher.cpp b/smocore/deviceManager/deviceReattacher.cpp index 729476d..bf46e2a 100644 --- a/smocore/deviceManager/deviceReattacher.cpp +++ b/smocore/deviceManager/deviceReattacher.cpp @@ -27,24 +27,24 @@ timer(ioThread->getIoService()) void DeviceReattacher::start() { - shouldContinue.store(true); - scheduleNextTimeout(); + shouldContinue.store(true); + scheduleNextTimeout(); } void DeviceReattacher::stop() { - shouldContinue.store(false); - timer.cancel(); + shouldContinue.store(false); + timer.cancel(); } void DeviceReattacher::scheduleNextTimeout() { - if (!shouldContinue.load()) { - return; - } + if (!shouldContinue.load()) { + return; + } - // Schedule the next timeout using the configured period - timer.expires_from_now( + // Schedule the next timeout using the configured period + timer.expires_from_now( boost::posix_time::milliseconds( CONFIG_MRNTT_DEVMGR_REATTACHER_PERIOD_MS)); @@ -56,27 +56,27 @@ void DeviceReattacher::onTimeout(const boost::system::error_code& error) { // Timer was cancelled, which is expected when stopping if (error == boost::asio::error::operation_aborted) { - return; - } + return; + } - if (error) + if (error) { - std::cerr << "DeviceReattacher: Timer error: " << error.message() + std::cerr << "DeviceReattacher: Timer error: " << error.message() << std::endl; - return; - } + return; + } - if (!shouldContinue.load()) { - return; - } + if (!shouldContinue.load()) { + return; + } - // Attempt to reattach all unattached devices from the known list - parent.attachAllUnattachedDevicesFromKnownListReq( - Callback( - nullptr, reattachmentCb)); + // Attempt to reattach all unattached devices from the known list + parent.attachAllUnattachedDevicesFromKnownListReq( + Callback( + nullptr, reattachmentCb)); - // Schedule the next timeout - scheduleNextTimeout(); + // Schedule the next timeout + scheduleNextTimeout(); } } // namespace device