From cbd4640f27bd25d4676e5d5237edd2707b73a6c0 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Wed, 18 Jan 2023 19:22:55 +0100 Subject: [PATCH] Use seconds since epoch as base value for the Source session versions to have increasing version upon daemon restarts --- daemon/session_manager.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon/session_manager.hpp b/daemon/session_manager.hpp index 5d0ef68..d7d4d66 100644 --- a/daemon/session_manager.hpp +++ b/daemon/session_manager.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "config.hpp" #include "driver_interface.hpp" @@ -114,6 +115,8 @@ class SessionManager { bool init() { if (!running_) { running_ = true; + g_session_version = std::chrono::system_clock::now().time_since_epoch() / + std::chrono::seconds(1); // to have an increasing session versions between restarts res_ = std::async(std::launch::async, &SessionManager::worker, this); } @@ -245,7 +248,7 @@ class SessionManager { uint32_t last_sink_update_{0}; /* used to handle session versioning */ - inline static std::atomic g_session_version{0}; + inline static std::atomic g_session_version{0}; }; #endif