This is an automated email from the ASF dual-hosted git repository.

kfujino pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new ae03ad5  Use the correct method to calculate session idle time in 
PersistentValve
ae03ad5 is described below

commit ae03ad53dc7a5b143af6e25cb480f3e9814f7b0b
Author: KeiichiFujino <kfuj...@apache.org>
AuthorDate: Tue Sep 1 21:34:20 2020 +0900

    Use the correct method to calculate session idle time in PersistentValve
---
 java/org/apache/catalina/valves/PersistentValve.java | 3 +--
 webapps/docs/changelog.xml                           | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/valves/PersistentValve.java 
b/java/org/apache/catalina/valves/PersistentValve.java
index 14ed90b..7734e26 100644
--- a/java/org/apache/catalina/valves/PersistentValve.java
+++ b/java/org/apache/catalina/valves/PersistentValve.java
@@ -215,8 +215,7 @@ public class PersistentValve extends ValveBase {
         if (session != null) {
             int maxInactiveInterval = session.getMaxInactiveInterval();
             if (maxInactiveInterval >= 0) {
-                int timeIdle = // Truncate, do not round up
-                    (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                int timeIdle = (int) (session.getIdleTimeInternal() / 1000L);
                 if (timeIdle >= maxInactiveInterval) {
                     return true;
                 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1e57e6f..3688578 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -97,6 +97,10 @@
         Added filtering expression for requests that are not supposed to use
         session in <code>PersistentValve</code>. (kfujino)
       </add>
+      <fix>
+        Use the correct method to calculate session idle time in
+        <code>PersistentValve</code>. (kfujino)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to