[cpp-sp] branch main updated: Fix run_once issue with start method.

Scott Cantor cantor.2 at osu.edu
Thu Jun 12 14:07:01 UTC 2025


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=a0aa9bd674a1736cd43d88d314be807f3659a4f8

The following commit(s) were added to refs/heads/main by this push:
     new a0aa9bd6 Fix run_once issue with start method.
a0aa9bd6 is described below

commit a0aa9bd674a1736cd43d88d314be807f3659a4f8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jun 12 10:06:54 2025 -0400

    Fix run_once issue with start method.
---
 shibsp/impl/AgentConfig.cpp                    | 18 ++++++++----------
 shibsp/session/impl/FilesystemSessionCache.cpp |  6 +++---
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/shibsp/impl/AgentConfig.cpp b/shibsp/impl/AgentConfig.cpp
index 05436275..b78010ad 100644
--- a/shibsp/impl/AgentConfig.cpp
+++ b/shibsp/impl/AgentConfig.cpp
@@ -68,10 +68,7 @@ namespace shibsp {
         }
 
         bool init(const char* inst_prefix=nullptr, const char* config_file=nullptr, bool rethrow=false);
-        bool start() {
-            call_once(m_startonce, &AgentInternalConfig::_start, this);
-            return true;
-        }
+        bool start();
         void term();
 
         const PathResolver& getPathResolver() const {
@@ -87,7 +84,6 @@ namespace shibsp {
 
     private:
         bool _init(const char* inst_prefix=nullptr, const char* config_file=nullptr, bool rethrow=false);
-        bool _start();
         void _term();
 
         bool initLogging();
@@ -95,7 +91,6 @@ namespace shibsp {
         void loadExtensions(Category& log);
 
         unsigned int m_initCount;
-        once_flag m_startonce;
         mutex m_lock;
         ptree m_config;
         bool m_cli;
@@ -313,11 +308,14 @@ void AgentInternalConfig::term()
     _term();
 }
 
-bool AgentInternalConfig::_start()
+bool AgentInternalConfig::start()
 {
-    SessionCache* cache = getAgent().getSessionCache(false);
-    if (cache) {
-        return cache->start();
+    lock_guard<mutex> locker(m_lock);
+    if (m_initCount == 1) {
+        SessionCache* cache = getAgent().getSessionCache(false);
+        if (cache) {
+            return cache->start();
+        }
     }
     return true;
 }
diff --git a/shibsp/session/impl/FilesystemSessionCache.cpp b/shibsp/session/impl/FilesystemSessionCache.cpp
index ae1e7a97..369d4a22 100644
--- a/shibsp/session/impl/FilesystemSessionCache.cpp
+++ b/shibsp/session/impl/FilesystemSessionCache.cpp
@@ -423,7 +423,7 @@ void* FilesystemSessionCache::file_cleanup_fn(void* p)
             continue;
         }
         else if (lastCleanup + pcache->m_cleanupInterval > now) {
-            pcache->m_spilog.debug("cleanup thread going back to sleep");
+            pcache->m_spilog.debug("file cleanup thread going back to sleep");
             continue;
         }
 
@@ -473,10 +473,10 @@ void* FilesystemSessionCache::file_cleanup_fn(void* p)
             pcache->m_spilog.error("caught exception during cleanup: %s", e.what());
         }
 
-        pcache->m_spilog.debug("cleanup thread completed work");
+        pcache->m_spilog.debug("file cleanup thread completed work");
     }
 
-    pcache->m_spilog.info("cleanup thread exiting");
+    pcache->m_spilog.info("file cleanup thread exiting");
 
     return nullptr;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list