directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r159379 - in directory/network/trunk/src: examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java java/org/apache/mina/io/socket/SocketSession.java
Date Tue, 29 Mar 2005 15:04:13 GMT
Author: trustin
Date: Tue Mar 29 07:04:11 2005
New Revision: 159379

URL: http://svn.apache.org/viewcvs?view=rev&rev=159379
Log:
* Fixed: IllegalStateException when user changes sessionReceiverBufferSize.

Modified:
    directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java?view=diff&r1=159378&r2=159379
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
(original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
Tue Mar 29 07:04:11 2005
@@ -20,8 +20,10 @@
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
+import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
+import org.apache.mina.io.socket.SocketSessionConfig;
 
 /**
  * {@link IoHandler} implementation for echo server. 
@@ -35,6 +37,12 @@
     {
         System.out.println( Thread.currentThread().getName() + ' '
                             + session.getRemoteAddress() + ": OPEN" );
+        
+        SessionConfig cfg = session.getConfig();
+        if( cfg instanceof SocketSessionConfig )
+        {
+            ( ( SocketSessionConfig ) cfg ).setSessionReceiveBufferSize( 2048 );
+        }
     }
 
     public void sessionClosed( IoSession session )

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java?view=diff&r1=159378&r2=159379
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java Tue Mar
29 07:04:11 2005
@@ -145,15 +145,16 @@
         this.attachment = attachment;
     }
 
-    ByteBuffer getReadBuffer()
+    synchronized ByteBuffer getReadBuffer()
     {
         return readBuf;
     }
     
     synchronized void setReadBuffer( ByteBuffer readBuf )
     {
-        this.readBuf.release(); // release old buffer
+        ByteBuffer oldBuf = this.readBuf;
         this.readBuf = readBuf;
+        oldBuf.release(); // release old buffer
     }
 
     Queue getWriteBufferQueue()



Mime
View raw message