[cpp-sp COMMIT] /branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp

noreply at shibboleth.net noreply at shibboleth.net
Tue Oct 11 18:57:09 BST 2011


Author: scantor
Date: Tue Oct 11 18:57:09 2011
New Revision: 3528

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3528&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-393

Modified:
    branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp

Modified: branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp?rev=3528&r1=3527&r2=3528&view=diff
==============================================================================
--- branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp (original)
+++ branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp Tue Oct 11 18:57:09 2011
@@ -144,7 +144,7 @@
 
         unsigned long getCacheTimeout(const Application& app) {
             // Computes offset for adjusting expiration of sessions.
-            // This can either be static, or dynamic based on the per-app session timeout.
+            // This can either be static, or dynamic based on the per-app session timeout or lifetime.
             if (m_cacheTimeout)
                 return m_cacheTimeout;
             pair<bool,unsigned int> timeout = pair<bool,unsigned int>(false, 3600);
@@ -154,7 +154,18 @@
                 if (!timeout.first)
                     timeout.second = 3600;
             }
-            return timeout.second + m_cacheAllowance;
+            // As long as one of the two factors is set, add them together.
+            if (timeout.second > 0 || m_cacheAllowance > 0)
+                return timeout.second + m_cacheAllowance;
+
+            // If timeouts are off, and there's no cache slop set, then use the lifetime.
+            timeout = pair<bool,unsigned int>(false, 28800);
+            if (props) {
+                timeout = props->getUnsignedInt("lifetime");
+                if (!timeout.first || timeout.second == 0)
+                    timeout.second = 28800;
+            }
+            return timeout.second;
         }
 
         Category& m_log;



More information about the commits mailing list