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

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


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

commit d98d5e6e563a85f6701f202d7bad240628ff8347
Author: KeiichiFujino <kfuj...@apache.org>
AuthorDate: Tue Sep 1 21:39:55 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 00b91e1..2108bf2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -91,6 +91,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