directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r722297 - /directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolCodecFactory.java
Date Mon, 01 Dec 2008 23:59:59 GMT
Author: elecharny
Date: Mon Dec  1 15:59:59 2008
New Revision: 722297

URL: http://svn.apache.org/viewvc?rev=722297&view=rev
Log:
Added all the needed code to handle the OOM protection, by limitating the PDU size.

The current limit is Integer.MAX_VALUE.

Modified:
    directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolCodecFactory.java

Modified: directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolCodecFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolCodecFactory.java?rev=722297&r1=722296&r2=722297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolCodecFactory.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolCodecFactory.java
Mon Dec  1 15:59:59 2008
@@ -44,6 +44,9 @@
 {
     /** the directory service for which this factor generates codecs */
     final private DirectoryService directoryService;
+    
+    /** The tag stored into the session if we want to set a max PDU size */
+    public final static String MAX_PDU_SIZE = "MAX_PDU_SIZE"; 
 
 
     /**
@@ -74,6 +77,14 @@
      */
     public ProtocolDecoder getDecoder( IoSession session )
     {
+        Object maxPDUSizeValue = session.getAttribute( MAX_PDU_SIZE );
+        int maxPDUSize = Integer.MAX_VALUE;
+        
+        if ( ( maxPDUSizeValue != null ) || ( maxPDUSizeValue instanceof Number ) )
+        {
+            maxPDUSize = ((Number)maxPDUSizeValue).intValue();
+        }
+        
         return new Asn1CodecDecoder( new MessageDecoder( new BinaryAttributeDetector()
         {
             public boolean isBinary( String id )
@@ -89,6 +100,7 @@
                     return false;
                 }
             }
-        }) );
+        },
+        maxPDUSize ) );
     }
 }
\ No newline at end of file



Mime
View raw message