diff options
| author | Stefan Boberg <[email protected]> | 2021-09-19 18:38:31 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-19 18:38:31 +0200 |
| commit | ed9d27f5e7b2e8eda835e67af302f097e5932366 (patch) | |
| tree | 6bcdffd7829290a6c6bbc03b466457fc7b37064a /zencore/session.cpp | |
| parent | Removed unnecessary ATL includes (diff) | |
| download | zen-ed9d27f5e7b2e8eda835e67af302f097e5932366.tar.xz zen-ed9d27f5e7b2e8eda835e67af302f097e5932366.zip | |
Added GetSessionIdString() which returns a text representation of the session id
Diffstat (limited to 'zencore/session.cpp')
| -rw-r--r-- | zencore/session.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/zencore/session.cpp b/zencore/session.cpp index d57d3685b..ce4bfae1b 100644 --- a/zencore/session.cpp +++ b/zencore/session.cpp @@ -9,14 +9,27 @@ namespace zen { static Oid GlobalSessionId; +static char GlobalSessionString[Oid::StringLength]; static std::once_flag SessionInitFlag; Oid GetSessionId() { - std::call_once(SessionInitFlag, [&] { GlobalSessionId.Generate(); }); + std::call_once(SessionInitFlag, [&] { + GlobalSessionId.Generate(); + GlobalSessionId.ToString(GlobalSessionString); + }); return GlobalSessionId; } +std::string_view +GetSessionIdString() +{ + // Ensure we actually have a generated session identifier + std::ignore = GetSessionId(); + + return std::string_view(GlobalSessionString, Oid::StringLength); +} + } // namespace zen
\ No newline at end of file |