You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-commits@incubator.apache.org by ng...@apache.org on 2007/05/23 11:35:31 UTC

svn commit: r540930 - /incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpStatisticsImpl.java

Author: ngn
Date: Wed May 23 04:35:30 2007
New Revision: 540930

URL: http://svn.apache.org/viewvc?view=rev&rev=540930
Log:
Fixed bug where the logout stats would not be counted correctly. Reported by Steve Jones. (FTPSERVER-87)

Modified:
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpStatisticsImpl.java

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpStatisticsImpl.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpStatisticsImpl.java?view=diff&rev=540930&r1=540929&r2=540930
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpStatisticsImpl.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpStatisticsImpl.java Wed May 23 04:35:30 2007
@@ -331,7 +331,9 @@
             Integer loginNumber = (Integer) statisticsTable.get(LOGIN_NUMBER);
             statisticsTable.put(LOGIN_NUMBER, new Integer(loginNumber.intValue() + 1));
             Integer loginNumberPerIP = (Integer) statisticsTable.get(connection.getSession().getClientAddress().getHostAddress());
-            if(loginNumberPerIP == null){//new connection from this ip
+            
+            if(loginNumberPerIP == null) {
+                //new connection from this ip
               statisticsTable.put(connection.getSession().getClientAddress().getHostAddress(), new Integer(1));
             } else{//this ip has connections already
               statisticsTable.put(connection.getSession().getClientAddress().getHostAddress(), new Integer(loginNumberPerIP.intValue() + 1));
@@ -365,13 +367,17 @@
           Integer loginNumber = (Integer) statisticsTable.get(LOGIN_NUMBER);
           statisticsTable.put(LOGIN_NUMBER, new Integer(loginNumber.intValue() - 1));
           Integer loginNumberPerIP = (Integer) statisticsTable.get(connection.getSession().getClientAddress().getHostAddress());
-          if(loginNumberPerIP != null){//this should always be true
-            if(loginNumberPerIP.intValue() <= 1){//the last login from this ip, remove this ip address
-              statisticsTable.remove(connection.getSession().getClientAddress().getHostAddress());
+          
+          if(loginNumberPerIP != null){
+            //this should always be true
+            if(loginNumberPerIP.intValue() <= 1){
+                //the last login from this ip, remove this ip address
+                statisticsTable.remove(connection.getSession().getClientAddress().getHostAddress());
+            } else{
+                //this ip has other logins, reduce the number
+                statisticsTable.put(connection.getSession().getClientAddress().getHostAddress(), new Integer(loginNumberPerIP.intValue() - 1));
             }
-          } else{//this ip has other logins, reduce the number
-            statisticsTable.put(connection.getSession().getClientAddress().getHostAddress(), new Integer(loginNumberPerIP.intValue() - 1));
-          }
+          } 
         }
         
         notifyLogout(connection);