No need to copy if bufferFactory created a direct buffer

This commit is contained in:
Trustin Lee 2010-01-28 03:27:28 +00:00
parent c8d5f1ab4a
commit 2b786116b5

View File

@ -334,8 +334,6 @@ class NioWorker implements Runnable {
break;
}
}
directBuffer.flip();
buffer.writeBytes(directBuffer);
failure = false;
} catch (ClosedChannelException e) {
// Can happen, and does not need a user attention.
@ -343,6 +341,8 @@ class NioWorker implements Runnable {
fireExceptionCaught(channel, t);
} finally {
if (fromPool) {
directBuffer.flip();
buffer.writeBytes(directBuffer);
directBufferPool.release(directBuffer);
}
}