directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r329211 - in /directory/network: branches/0.8/src/java/org/apache/mina/io/socket/SocketIoProcessor.java trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java
Date Fri, 28 Oct 2005 14:29:25 GMT
Author: trustin
Date: Fri Oct 28 07:29:09 2005
New Revision: 329211

URL: http://svn.apache.org/viewcvs?rev=329211&view=rev
Log:
Resolved issue: DIRMINA-110 - Exceptions thrown while writing data are not reported.
* Removed try-finally block in flush(SocketSession) to fix the problem


Modified:
    directory/network/branches/0.8/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java

Modified: directory/network/branches/0.8/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.8/src/java/org/apache/mina/io/socket/SocketIoProcessor.java?rev=329211&r1=329210&r2=329211&view=diff
==============================================================================
--- directory/network/branches/0.8/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
(original)
+++ directory/network/branches/0.8/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
Fri Oct 28 07:29:09 2005
@@ -502,34 +502,24 @@
                 continue;
             }
 
-            int writtenBytes = 0;
-            try
+            int writtenBytes = ch.write( buf.buf() );
+            if( writtenBytes > 0 )
             {
-                writtenBytes = ch.write( buf.buf() );
+                session.increaseWrittenBytes( writtenBytes );
+                session.resetIdleCount( IdleStatus.BOTH_IDLE );
+                session.resetIdleCount( IdleStatus.WRITER_IDLE );
             }
-            finally
-            {
-                if( writtenBytes > 0 )
-                {
-                    session.increaseWrittenBytes( writtenBytes );
-                    session.resetIdleCount( IdleStatus.BOTH_IDLE );
-                    session.resetIdleCount( IdleStatus.WRITER_IDLE );
-                }
 
-                SelectionKey key = session.getSelectionKey();
-                if( buf.hasRemaining() )
-                {
-                    // Kernel buffer is full
-                    key
-                            .interestOps( key.interestOps()
-                                          | SelectionKey.OP_WRITE );
-                    break;
-                }
-                else
-                {
-                    key.interestOps( key.interestOps()
-                                     & ( ~SelectionKey.OP_WRITE ) );
-                }
+            SelectionKey key = session.getSelectionKey();
+            if( buf.hasRemaining() )
+            {
+                // Kernel buffer is full
+                key.interestOps( key.interestOps() | SelectionKey.OP_WRITE );
+                break;
+            }
+            else
+            {
+                key.interestOps( key.interestOps() & ( ~SelectionKey.OP_WRITE ) );
             }
         }
     }

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java?rev=329211&r1=329210&r2=329211&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java
Fri Oct 28 07:29:09 2005
@@ -493,32 +493,22 @@
                 continue;
             }
 
-            int writtenBytes = 0;
-            try
+            int writtenBytes = ch.write( buf.buf() );
+            if( writtenBytes > 0 )
             {
-                writtenBytes = ch.write( buf.buf() );
+                session.increaseWrittenBytes( writtenBytes );
             }
-            finally
-            {
-                if( writtenBytes > 0 )
-                {
-                    session.increaseWrittenBytes( writtenBytes );
-                }
 
-                SelectionKey key = session.getSelectionKey();
-                if( buf.hasRemaining() )
-                {
-                    // Kernel buffer is full
-                    key
-                            .interestOps( key.interestOps()
-                                          | SelectionKey.OP_WRITE );
-                    break;
-                }
-                else
-                {
-                    key.interestOps( key.interestOps()
-                                     & ( ~SelectionKey.OP_WRITE ) );
-                }
+            SelectionKey key = session.getSelectionKey();
+            if( buf.hasRemaining() )
+            {
+                // Kernel buffer is full
+                key.interestOps( key.interestOps() | SelectionKey.OP_WRITE );
+                break;
+            }
+            else
+            {
+                key.interestOps( key.interestOps() & ( ~SelectionKey.OP_WRITE ) );
             }
         }
     }



Mime
View raw message