directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r123281 - in incubator/directory/network/trunk/mina/src/java/org/apache/mina: io io/socket protocol
Date Fri, 24 Dec 2004 07:12:13 GMT
Author: trustin
Date: Thu Dec 23 23:12:12 2004
New Revision: 123281

URL: http://svn.apache.org/viewcvs?view=rev&rev=123281
Log:
Fixed: All messages are not decoded
Better performance when IoHandler read up all of read buffer.
Modified:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java?view=diff&rev=123281&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java&r1=123280&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java&r2=123281
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java	Thu
Dec 23 23:12:12 2004
@@ -36,9 +36,9 @@
 
     void close();
     
-    void write(byte[] buf, Object marker);
-
     void write(ByteBuffer buf, Object marker);
+
+    void write(byte[] buf, Object marker);
 
     void write(byte[] buf, int offset, int length, Object marker);
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java?view=diff&rev=123281&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java&r1=123280&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java&r2=123281
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
Thu Dec 23 23:12:12 2004
@@ -238,7 +238,10 @@
 
             synchronized( buf )
             {
-                buf.compact();
+                if (buf.hasRemaining())
+                    buf.compact();
+                else
+                    buf.clear();
 
                 try
                 {

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java?view=diff&rev=123281&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r1=123280&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r2=123281
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Thu Dec 23 23:12:12 2004
@@ -112,14 +112,24 @@
             Object result;
             try
             {
-                synchronized( in )
-                {
-                    result = decoder.decode( psession, in );
-                }
+                for ( ;; ) {
+                    result = null;
+                    synchronized( in )
+                    {
+                        if (in.hasRemaining()) {
+                            result = decoder.decode( psession, in );
+                        }
+                    }
 
-                if( result != null )
-                {
-                    filterManager.fireMessageReceived( psession, result );
+                    if( result == null )
+                    {
+                        // read up all data
+                        break;
+                    }
+                    else
+                    {
+                        filterManager.fireMessageReceived( psession, result );
+                    } 
                 }
             }
             catch( Throwable t )

Mime
View raw message