directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r330396 - /directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java
Date Thu, 03 Nov 2005 00:50:12 GMT
Author: trustin
Date: Wed Nov  2 16:50:08 2005
New Revision: 330396

URL: http://svn.apache.org/viewcvs?rev=330396&view=rev
Log:
Added a blocking code to messageReceived event filter in BlacklistFilter.

Modified:
    directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java

Modified: directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java?rev=330396&r1=330395&r2=330396&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/BlacklistFilter.java Wed Nov 
2 16:50:08 2005
@@ -65,9 +65,27 @@
         }
         else
         {
-            SessionLog.info( session, "Remote address in the blacklist; closing." );
-            session.close();
+            blockSession( session );
         }
+    }
+    
+    public void messageReceived( NextFilter nextFilter, IoSession session, Object message
)
+    {
+        if( !isBlocked( session ) )
+        {
+            // forward if not blocked
+            nextFilter.messageReceived( session, message );
+        }
+        else
+        {
+            blockSession( session );
+        }
+    }
+
+    private void blockSession( IoSession session )
+    {
+        SessionLog.info( session, "Remote address in the blacklist; closing." );
+        session.close();
     }
 
     private boolean isBlocked( IoSession session )



Mime
View raw message