summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKun Yi <kunyi731@gmail.com>2019-11-19 13:45:05 -0800
committerKun Yi <kunyi731@gmail.com>2019-11-19 13:50:11 -0800
commit7fc52c8fe3bc7cc9b57a007ce1b7c38e60f9602f (patch)
treeeccafb623637fea1caf837c4dae2a6c251a82c97
parentc892f4a0a863ff982b108d1a73f65dacb2cfbdac (diff)
downloadphosphor-ipmi-blobs-7fc52c8fe3bc7cc9b57a007ce1b7c38e60f9602f.tar.gz
phosphor-ipmi-blobs-7fc52c8fe3bc7cc9b57a007ce1b7c38e60f9602f.zip
Store the last action time in session info
Add a timestamp member in SessionStat to capture when the session sees activity last, and update it with every action. The timestamp will be used to check when the session should expire. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ic781d54173099bff76b3c37dd296521680fe7986
-rw-r--r--manager.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/manager.hpp b/manager.hpp
index 1c04c6a..e7a9a97 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <blobs-ipmid/blobs.hpp>
+#include <chrono>
#include <ctime>
#include <ipmid/oemrouter.hpp>
#include <memory>
@@ -35,6 +36,12 @@ struct SessionInfo
std::string blobId;
GenericBlobInterface* handler;
uint16_t flags;
+
+ /* Initially set during open(). read/write/writeMeta/commit/stat operations
+ * would update it.
+ */
+ std::chrono::time_point<std::chrono::steady_clock> lastActionTime =
+ std::chrono::steady_clock::now();
};
class ManagerInterface
@@ -249,6 +256,7 @@ class BlobManager : public ManagerInterface
if (auto item = sessions.find(session);
item != sessions.end() && (item->second.flags & requiredFlags))
{
+ item->second.lastActionTime = std::chrono::steady_clock::now();
return item->second.handler;
}
return nullptr;
OpenPOWER on IntegriCloud