version_handler: Don't store session information immediately
This can cause spurious trigger aborts when open's fail and cleanup is
called on the failed session.
Change-Id: I1c49f248b6f56bbecc0d51fafaabe871d23b1d7d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/bmc/version-handler/version_handler.cpp b/bmc/version-handler/version_handler.cpp
index 5d66713..9918e33 100644
--- a/bmc/version-handler/version_handler.cpp
+++ b/bmc/version-handler/version_handler.cpp
@@ -70,22 +70,20 @@
}
auto& v = *blobInfoMap.at(path);
- sessionToBlob[session] = &v;
-
if (v.blobState == blobs::StateFlags::open_read)
{
fprintf(stderr, "open %s fail: blob already opened for read\n",
path.c_str());
- cleanup(session);
return false;
}
if (v.actions->onOpen->trigger() == false)
{
fprintf(stderr, "open %s fail: onOpen trigger failed\n", path.c_str());
- cleanup(session);
return false;
}
+
v.blobState = blobs::StateFlags::open_read;
+ sessionToBlob[session] = &v;
return true;
}
@@ -147,10 +145,7 @@
try
{
auto& pack = *sessionToBlob.at(session);
- if (pack.actions->onOpen->status() == ActionStatus::running)
- {
- pack.actions->onOpen->abort();
- }
+ pack.actions->onOpen->abort();
pack.blobState = static_cast<blobs::StateFlags>(0);
sessionToBlob.erase(session);
return true;