Hello all.

I'm looking at the read() method of the SocketIoProcessor class and I don't get why is the Buffer allocation outside the try/catch block... in case of a OOM error the allocation will fail and the IOSession will not be notified.

I propose the following change:

     private void read( SocketSessionImpl session )
     {
-        ByteBuffer buf = ByteBuffer.allocate( session.getReadBufferSize() );
-        SocketChannel ch = session.getChannel();
-
+       ByteBuffer buf = null;
         try
         {
+            buf = ByteBuffer.allocate( session.getReadBufferSize() );
+            SocketChannel ch = session.getChannel();


Regards,
Luis Neves



Reply via email to