Fix NvmeSensor assert
As NvmeSensor has many async captures, deleting
the NvmeContext is not enough to make the destructor
fire, we must also manually stop all timers and
connections.
Tested: DC Cycled, assert went away
Change-Id: I64f3eab1451d73d723110a79ed5bb38419982088
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index d683174..15a0d14 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -412,7 +412,7 @@
});
}
-NVMeContext::~NVMeContext()
+void NVMeContext::close()
{
scanTimer.cancel();
mctpResponseTimer.cancel();
@@ -420,6 +420,11 @@
nvmeMCTP::closeInFd(rootBus);
}
+NVMeContext::~NVMeContext()
+{
+ close();
+}
+
NVMeSensor::NVMeSensor(sdbusplus::asio::object_server& objectServer,
boost::asio::io_service& io,
std::shared_ptr<sdbusplus::asio::connection>& conn,