From 186ceb1fbf53bc26e373a73894161d9df83d93e2 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Wed, 18 Feb 2009 14:19:40 +0000
Subject: [PATCH] Commit SASL Phase2 changes. Issue 3805. Unit tests to follow later.

---
 opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index a5b1d24..bf9cd1d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -195,6 +195,8 @@
 
   private ASN1ByteChannelReader asn1Reader;
 
+  private static int APPLICATION_BUFFER_SIZE = 4096;
+
   private final RedirectingByteChannel saslChannel;
   private final RedirectingByteChannel tlsChannel;
   private ConnectionSecurityProvider activeProvider = null;
@@ -286,7 +288,7 @@
     saslChannel =
         RedirectingByteChannel.getRedirectingByteChannel(tlsChannel);
     this.asn1Reader =
-        ASN1.getReader(saslChannel, 4096, connectionHandler
+        ASN1.getReader(saslChannel, APPLICATION_BUFFER_SIZE, connectionHandler
             .getMaxRequestSize());
 
     connectionID = DirectoryServer.newConnectionAccepted(this);
@@ -349,6 +351,7 @@
    * @return The socket channel that can be used to communicate with the
    *         client.
    */
+  @Override
   public SocketChannel getSocketChannel()
   {
     return clientChannel;
@@ -775,7 +778,8 @@
         writerBuffer.writer = ASN1.getWriter(saslChannel, appBufSize);
       }
       else
-        writerBuffer.writer = ASN1.getWriter(saslChannel, 4096);
+        writerBuffer.writer =
+                          ASN1.getWriter(saslChannel, APPLICATION_BUFFER_SIZE);
       cachedBuffers.set(writerBuffer);
     }
     try
@@ -795,7 +799,7 @@
 
         if (keepStats)
         {
-          // TODO SASLPhase2 hard-coded for now, flush probably needs to
+          // TODO hard-coded for now, flush probably needs to
           // return how many bytes were flushed.
           statTracker.updateMessageWritten(message, 4096);
         }
@@ -2552,6 +2556,19 @@
 
 
   /**
+   * Retrieves the TLS redirecting byte channel used in a LDAP client
+   * connection.
+   *
+   * @return The TLS redirecting byte channel.
+   */
+   @Override
+   public RedirectingByteChannel getChannel() {
+     return this.tlsChannel;
+   }
+
+
+
+  /**
    * {@inheritDoc}
    */
   @Override
@@ -2565,6 +2582,23 @@
 
 
 
+  /**
+   * Retrieves the application buffer size used in a LDAP client connection.
+   * If a active security provider is being used, then the application buffer
+   * size of that provider is returned.
+   *
+   * @return The application buffer size.
+   */
+  @Override
+  public int getAppBufferSize() {
+    if(activeProvider != null)
+      return activeProvider.getAppBufSize();
+    else
+      return APPLICATION_BUFFER_SIZE;
+  }
+
+
+
   private void initializeOperationMonitors()
   {
     this.addMonitor = OperationMonitor.getOperationMonitor(ADD);

--
Gitblit v1.10.0