Fix unmounting image in proxy mode.
Sometimes Slot0 got higher key than Slot1 and erase function for Slot1
invalidates elements with keys not less than the erased element.
In that case invalid slot0 will be unmounted.
Change order of calling close() and erase() functions to
unmount correct device.
Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0
Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 7b765e2..97c8b57 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -413,9 +413,9 @@
BMCWEB_LOG_DEBUG << "No session to close";
return;
}
+ session->second->close();
// Remove reference to session in global map
sessions.erase(session);
- session->second->close();
})
.onmessage([](crow::websocket::Connection& conn,
const std::string& data, bool) {