version-handler: Remove superfluous open session check
The phosphor-ipmi-flash API guarantees that calls to open() will not
happen with duplicate session IDs.
Change-Id: Ife88b2743322387e5cc6ebe2b34567c3d2d2957a
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/bmc/version-handler/test/version_open_unittest.cpp b/bmc/version-handler/test/version_open_unittest.cpp
index 7c7e5d2..0e80a94 100644
--- a/bmc/version-handler/test/version_open_unittest.cpp
+++ b/bmc/version-handler/test/version_open_unittest.cpp
@@ -65,19 +65,6 @@
EXPECT_TRUE(h->open(defaultSessionNumber, blobs::read, "blob0"));
}
-TEST_F(VersionOpenBlobTest, VerifyDuplicateSessionNumberFails)
-{
- EXPECT_CALL(*tm.at("blob0"), trigger()).Times(1).WillOnce(Return(true));
- EXPECT_CALL(*tm.at("blob1"), trigger()).Times(1).WillOnce(Return(true));
- EXPECT_TRUE(h->open(defaultSessionNumber, blobs::read, "blob1"));
- /* the duplicate session number of 0
- * should cause a failure for the open of a different blob
- */
- EXPECT_FALSE(h->open(defaultSessionNumber, blobs::read, "blob0"));
- /* open after fail due to seq number works */
- EXPECT_TRUE(h->open(defaultSessionNumber + 1, blobs::read, "blob0"));
-}
-
TEST_F(VersionOpenBlobTest, VerifyDoubleOpenFails)
{
EXPECT_CALL(*tm.at("blob1"), trigger())
diff --git a/bmc/version-handler/version_handler.cpp b/bmc/version-handler/version_handler.cpp
index 76de76c..5d66713 100644
--- a/bmc/version-handler/version_handler.cpp
+++ b/bmc/version-handler/version_handler.cpp
@@ -70,13 +70,7 @@
}
auto& v = *blobInfoMap.at(path);
- auto [it, emplaced] = sessionToBlob.try_emplace(session, &v);
- if (!emplaced)
- {
- fprintf(stderr, "open %s fail: session number %d assigned to %s\n",
- path.c_str(), session, it->second->blobId.c_str());
- return false;
- }
+ sessionToBlob[session] = &v;
if (v.blobState == blobs::StateFlags::open_read)
{