Author: mwebb
Date: Sat Jun 23 20:17:39 2007
New Revision: 550157

URL: http://svn.apache.org/viewvc?view=rev&rev=550157
Log:
updated isConnectionOk to move the call to System.currentTimeMillis closer to 
the test of the value with the last connection time.

Modified:
    
mina/trunk/core/src/main/java/org/apache/mina/filter/ConnectionThrottleFilter.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/ConnectionThrottleFilter.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/ConnectionThrottleFilter.java?view=diff&rev=550157&r1=550156&r2=550157
==============================================================================
--- 
mina/trunk/core/src/main/java/org/apache/mina/filter/ConnectionThrottleFilter.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/filter/ConnectionThrottleFilter.java
 Sat Jun 23 20:17:39 2007
@@ -86,16 +86,16 @@
         SocketAddress remoteAddress = session.getRemoteAddress();
         if( remoteAddress instanceof InetSocketAddress )
         {
-            long now = System.currentTimeMillis();
             InetSocketAddress addr = (InetSocketAddress)remoteAddress;
+            long now = System.currentTimeMillis();
             
             if( clients.containsKey(addr.getAddress().getHostAddress())){
-                Long time = clients.get(addr.getAddress().getHostAddress());
+                Long lastConnTime = 
clients.get(addr.getAddress().getHostAddress());
                 clients.put(addr.getAddress().getHostAddress(), now);
 
                 // if the interval between now and the last connection is 
                 // less than the allowed interval, return false
-                if( (now-time) < allowedInterval ){
+                if( (now-lastConnTime) < allowedInterval ){
                     return false;
                 } else {
                        return true;


Reply via email to