summaryrefslogtreecommitdiffstats
path: root/manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'manager.cpp')
-rw-r--r--manager.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/manager.cpp b/manager.cpp
index 870bf60..64cc08f 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -27,17 +27,21 @@ namespace blobs
void BlobManager::eraseSession(GenericBlobInterface* handler, uint16_t session)
{
- /* Ok for openSessions[handler] to be an empty set */
- openSessions[handler].erase(session);
-
- auto path = getPath(session);
- openFiles[path]--;
- if (openFiles[path] == 0)
+ if (auto item = sessions.find(session); item != sessions.end())
{
- openFiles.erase(path);
+ const auto& blobId = item->second.blobId;
+
+ /* Ok for openSessions[handler] to be an empty set */
+ openSessions[handler].erase(session);
+ openFiles[blobId]--;
+ if (openFiles[blobId] == 0)
+ {
+ openFiles.erase(blobId);
+ }
+
+ /* Erase at the end after using the session info */
+ sessions.erase(session);
}
- /* Cannot erase before getPath() is called */
- sessions.erase(session);
}
void BlobManager::cleanUpStaleSessions(GenericBlobInterface* handler)
@@ -183,16 +187,6 @@ GenericBlobInterface* BlobManager::getActionHandle(uint16_t session,
return nullptr;
}
-std::string BlobManager::getPath(uint16_t session) const
-{
- if (auto item = sessions.find(session); item != sessions.end())
- {
- return item->second.blobId;
- }
-
- return "";
-}
-
bool BlobManager::stat(const std::string& path, BlobMeta* meta)
{
/* meta should never be NULL. */
OpenPOWER on IntegriCloud