Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 64779 invoked from network); 15 Apr 2005 10:38:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Apr 2005 10:38:47 -0000 Received: (qmail 37035 invoked by uid 500); 15 Apr 2005 10:38:46 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 36996 invoked by uid 500); 15 Apr 2005 10:38:45 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 36982 invoked by uid 99); 15 Apr 2005 10:38:45 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 15 Apr 2005 03:38:45 -0700 Received: (qmail 64733 invoked by uid 65534); 15 Apr 2005 10:38:44 -0000 Message-ID: <20050415103844.64732.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Fri, 15 Apr 2005 10:38:44 -0000 Subject: svn commit: r161435 - in directory/network/trunk/src/java/org/apache/mina: io/filter/SSLFilter.java protocol/codec/Asn1CodecEncoder.java To: commits@directory.apache.org From: trustin@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: trustin Date: Fri Apr 15 03:38:41 2005 New Revision: 161435 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D161435 Log: SSLFilter and Asn1CodecEncoder doesn't copy ByteBuffers thanks to ByteBuffe= r=2Ewrap() Modified: directory/network/trunk/src/java/org/apache/mina/io/filter/SSLFilter.ja= va directory/network/trunk/src/java/org/apache/mina/protocol/codec/Asn1Cod= ecEncoder.java Modified: directory/network/trunk/src/java/org/apache/mina/io/filter/SSLFil= ter.java URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apa= che/mina/io/filter/SSLFilter.java?view=3Ddiff&r1=3D161434&r2=3D161435 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/network/trunk/src/java/org/apache/mina/io/filter/SSLFilter.ja= va (original) +++ directory/network/trunk/src/java/org/apache/mina/io/filter/SSLFilter.ja= va Fri Apr 15 03:38:41 2005 @@ -240,8 +240,8 @@ debug.print( "encrypt: " + buf ); } sslHandler.encrypt( buf.buf() ); - ByteBuffer encryptedBuffer =3D copy( sslHandler - .getOutNetBuffer() ); + ByteBuffer encryptedBuffer =3D + ByteBuffer.wrap( sslHandler.getOutNetBuffer() = ); =20 if( debug !=3D null ) { @@ -284,7 +284,8 @@ if( sslHandler.getAppBuffer().hasRemaining() ) { // forward read app data - ByteBuffer readBuffer =3D copy( sslHandler.getAppBuffer() ); + ByteBuffer readBuffer =3D + ByteBuffer.wrap( sslHandler.getAppBuffer() ); if( debug !=3D null ) { debug.print( "app data read: " + readBuffer + " (" + readB= uffer.getHexDump() + ')' ); @@ -319,7 +320,8 @@ debug.print( "write outNetBuffer: " + sslHandler.getOutNetBuffer() ); } - ByteBuffer writeBuffer =3D copy( sslHandler.getOutNetBuffer() = ); + ByteBuffer writeBuffer =3D + ByteBuffer.wrap( sslHandler.getOutNetBuffer() ); if( debug !=3D null ) { debug.print( "session write: " + writeBuffer ); @@ -348,8 +350,8 @@ debug.print( "write outNetBuffer2: " + sslHandler.getOutNetBuffer() ); } - ByteBuffer writeBuffer2 =3D copy( sslHandler - .getOutNetBuffer() ); + ByteBuffer writeBuffer2 =3D + ByteBuffer.wrap ( sslHandler.getOutNetBuffer() ); session.write( writeBuffer2, null ); } } @@ -361,21 +363,6 @@ sslHandler.setWritingEncryptedData( false ); } } - } - - /** - * Creates a new Mina byte buffer that is a deep copy of the remaining= bytes - * in the given buffer (between index buf.position() and buf.limit()) - * - * @param src the buffer to copy - * @return the new buffer, ready to read from - */ - private ByteBuffer copy( java.nio.ByteBuffer src ) - { - ByteBuffer copy =3D ByteBuffer.allocate( src.remaining() ); - copy.put( src ); - copy.flip(); - return copy; } =20 // Utilities to mainpulate SSLHandler based on IoSession Modified: directory/network/trunk/src/java/org/apache/mina/protocol/codec/A= sn1CodecEncoder.java URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apa= che/mina/protocol/codec/Asn1CodecEncoder.java?view=3Ddiff&r1=3D161434&r2=3D= 161435 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/network/trunk/src/java/org/apache/mina/protocol/codec/Asn1Cod= ecEncoder.java (original) +++ directory/network/trunk/src/java/org/apache/mina/protocol/codec/Asn1Cod= ecEncoder.java Fri Apr 15 03:38:41 2005 @@ -59,10 +59,7 @@ if( encoded instanceof java.nio.ByteBuffer ) { java.nio.ByteBuffer buf =3D ( java.nio.ByteBuffer ) encode= d; - ByteBuffer outBuf =3D ByteBuffer.allocate( buf.remaining()= ); - outBuf.put( buf ); - outBuf.flip(); - encOut.write( outBuf ); + encOut.write( ByteBuffer.wrap( buf ) ); } else if( encoded instanceof Object[] ) {