directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r169323 - in /directory/network/branches/api_integration/src/java/org/apache/mina: common/AbstractIoFilterChain.java filter/SSLFilter.java filter/SSLHandler.java
Date Mon, 09 May 2005 15:06:13 GMT
Author: trustin
Date: Mon May  9 08:06:12 2005
New Revision: 169323

URL: http://svn.apache.org/viewcvs?rev=169323&view=rev
Log:
Merged fix for DIRMINA-31

Modified:
    directory/network/branches/api_integration/src/java/org/apache/mina/common/AbstractIoFilterChain.java
    directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLFilter.java
    directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLHandler.java

Modified: directory/network/branches/api_integration/src/java/org/apache/mina/common/AbstractIoFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/api_integration/src/java/org/apache/mina/common/AbstractIoFilterChain.java?rev=169323&r1=169322&r2=169323&view=diff
==============================================================================
--- directory/network/branches/api_integration/src/java/org/apache/mina/common/AbstractIoFilterChain.java
(original)
+++ directory/network/branches/api_integration/src/java/org/apache/mina/common/AbstractIoFilterChain.java
Mon May  9 08:06:12 2005
@@ -453,7 +453,7 @@
         
         try
         {
-            entry.filter.filterWrite( entry.prevFilter, session, message );
+            entry.filter.filterWrite( entry.nextFilter, session, message );
         }
         catch( Throwable e )
         {
@@ -500,8 +500,6 @@
 
         private final NextFilter nextFilter;
         
-        private final NextFilter prevFilter;
-
         private Entry( Entry prevEntry, Entry nextEntry,
                        String name, IoFilter filter )
         {
@@ -556,46 +554,6 @@
                 {
                     Entry nextEntry = Entry.this.nextEntry;
                     callNextMessageSent( nextEntry, session, message );
-                }
-                
-                public void filterWrite( IoSession session, Object message )
-                {
-                    throw new IllegalStateException();
-                }
-            };
-            
-            this.prevFilter = new NextFilter()
-            {
-
-                public void sessionOpened( IoSession session )
-                {
-                    throw new IllegalStateException();
-                }
-
-                public void sessionClosed( IoSession session )
-                {
-                    throw new IllegalStateException();
-                }
-
-                public void sessionIdle( IoSession session, IdleStatus status )
-                {
-                    throw new IllegalStateException();
-                }
-
-                public void exceptionCaught( IoSession session,
-                                            Throwable cause )
-                {
-                    throw new IllegalStateException();
-                }
-
-                public void messageReceived( IoSession session, Object message )
-                {
-                    throw new IllegalStateException();
-                }
-
-                public void messageSent( IoSession session, Object message )
-                {
-                    throw new IllegalStateException();
                 }
                 
                 public void filterWrite( IoSession session, Object message )

Modified: directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLFilter.java?rev=169323&r1=169322&r2=169323&view=diff
==============================================================================
--- directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLFilter.java
(original)
+++ directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLFilter.java
Mon May  9 08:06:12 2005
@@ -31,7 +31,6 @@
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ByteBufferProxy;
 import org.apache.mina.common.IoFilterAdapter;
-import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 
 /**
@@ -48,18 +47,7 @@
 public class SSLFilter extends IoFilterAdapter
 {
     private static final Logger log = Logger.getLogger( SSLFilter.class.getName() );
-    /**
-     * A marker which is passed with {@link IoHandler#messageSent(IoSession, Object)}
-     * when <tt>SSLFilter</tt> writes data other then user actually requested.
-     */
-    public static final Object SSL_MARKER = new Object()
-    {
-        public String toString()
-        {
-            return "SSL_MARKER";
-        }
-    };
-    
+
     // SSL Context
     private SSLContext sslContext;
 
@@ -188,7 +176,7 @@
     public void sessionOpened( NextFilter nextFilter, IoSession session ) throws SSLException
     {
         // Create an SSL handler
-        createSSLSessionHandler( session );
+        createSSLSessionHandler( nextFilter, session );
         nextFilter.sessionOpened( session );
     }
 
@@ -210,7 +198,7 @@
                   sslHandler.shutdown();
                   
                   // there might be data to write out here?
-                  writeNetBuffer( session, sslHandler );
+                  writeNetBuffer( nextFilter, session, sslHandler );
                }
                finally
                {
@@ -241,7 +229,7 @@
                 try
                 {
                     // forward read encrypted data to SSL handler
-                    sslHandler.messageReceived( buf.buf() );
+                    sslHandler.messageReceived( nextFilter, buf.buf() );
 
                     // Handle data to be forwarded to application or written to net
                     handleSSLData( nextFilter, session, sslHandler );
@@ -295,7 +283,7 @@
     {
         ByteBuffer buf = ( ByteBuffer ) message;
 
-        SSLHandler handler = createSSLSessionHandler( session );
+        SSLHandler handler = createSSLSessionHandler( nextFilter, session );
         if( log.isLoggable( Level.FINEST ) )
         {
             log.log( Level.FINEST, session + " Filtered Write: " + handler );
@@ -359,7 +347,7 @@
     // Utiliities
 
     private void handleSSLData( NextFilter nextFilter, IoSession session,
-                               SSLHandler handler ) throws SSLException
+                                SSLHandler handler ) throws SSLException
     {
         // Flush any buffered write requests occurred before handshaking.
         if( handler.isInitialHandshakeComplete() )
@@ -368,7 +356,7 @@
         }
 
         // Write encrypted data to be written (if any)
-        writeNetBuffer( session, handler );
+        writeNetBuffer( nextFilter, session, handler );
 
         // handle app. data read (if any)
         handleAppDataRead( nextFilter, session, handler );
@@ -393,7 +381,7 @@
         }
     }
 
-    void writeNetBuffer( IoSession session, SSLHandler sslHandler )
+    void writeNetBuffer( NextFilter nextFilter, IoSession session, SSLHandler sslHandler
)
             throws SSLException
     {
         // Check if any net data needed to be writen
@@ -425,14 +413,14 @@
                 log.log( Level.FINEST, session + " session write: " + writeBuffer );
             }
             //debug("outNetBuffer (after copy): {0}", sslHandler.getOutNetBuffer());
-            session.write( writeBuffer );
+            filterWrite( nextFilter, session, writeBuffer );
 
             // loop while more writes required to complete handshake
             while( sslHandler.needToCompleteInitialHandshake() )
             {
                 try
                 {
-                    sslHandler.continueHandshake();
+                    sslHandler.continueHandshake( nextFilter );
                 }
                 catch( SSLException ssle )
                 {
@@ -480,7 +468,7 @@
 
     // Utilities to mainpulate SSLHandler based on IoSession
 
-    private SSLHandler createSSLSessionHandler( IoSession session ) throws SSLException
+    private SSLHandler createSSLSessionHandler( NextFilter nextFilter, IoSession session
) throws SSLException
     {
         SSLHandler handler = ( SSLHandler ) sslSessionHandlerMap.get( session );
         if( handler == null )
@@ -496,7 +484,7 @@
                         handler =
                             new SSLHandler( this, sslContext, session );
                         sslSessionHandlerMap.put( session, handler );
-                        handler.doHandshake();
+                        handler.doHandshake( nextFilter );
                         done = true;
                     }
                     finally 

Modified: directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLHandler.java?rev=169323&r1=169322&r2=169323&view=diff
==============================================================================
--- directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLHandler.java
(original)
+++ directory/network/branches/api_integration/src/java/org/apache/mina/filter/SSLHandler.java
Mon May  9 08:06:12 2005
@@ -188,7 +188,6 @@
     {
         NextFilter nextFilter;
         org.apache.mina.common.ByteBuffer scheduledBuf;
-        Object scheduledMarker;
         
         while( ( scheduledBuf = ( org.apache.mina.common.ByteBuffer ) writeBufferQueue.pop()
) != null )
         {
@@ -209,7 +208,7 @@
      * @param buf buffer to decrypt
      * @throws SSLException on errors
      */
-    public void messageReceived( ByteBuffer buf ) throws SSLException
+    public void messageReceived( NextFilter nextFilter, ByteBuffer buf ) throws SSLException
     {
         if ( buf.limit() > inNetBuffer.remaining() ) {
             // We have to expand inNetBuffer
@@ -232,7 +231,7 @@
         inNetBuffer.put( buf );
         if( !initialHandshakeComplete )
         {
-            doHandshake();
+            doHandshake( nextFilter );
         }
         else
         {
@@ -245,13 +244,13 @@
      *
      * @throws SSLException on errors
      */
-    public void continueHandshake() throws SSLException
+    public void continueHandshake( NextFilter nextFilter ) throws SSLException
     {
         if( log.isLoggable( Level.FINEST ) )
         {
             log.log( Level.FINEST, session + " continueHandshake()" );
         }
-        doHandshake();
+        doHandshake( nextFilter );
     }
 
     /**
@@ -399,7 +398,7 @@
     /**
      * Perform any handshaking processing.
      */
-    synchronized void doHandshake() throws SSLException
+    synchronized void doHandshake( NextFilter nextFilter ) throws SSLException
     {
 
         if( log.isLoggable( Level.FINEST ) )
@@ -470,7 +469,7 @@
 
                 outNetBuffer.flip();
                 initialHandshakeStatus = result.getHandshakeStatus();
-                parent.writeNetBuffer( session, this );
+                parent.writeNetBuffer( nextFilter, session, this );
                 // return to allow data on out buffer being sent
                 // TODO: We might want to send more data immidiatley?
             }



Mime
View raw message