Merge pull request #553 from jfallows/aio-unmodified-buffer

Ensure unmodified buffer delivered via pipeline after AIO read completes
This commit is contained in:
Norman Maurer 2012-08-24 09:25:01 -07:00
commit cd9a36d4e7
3 changed files with 3 additions and 2 deletions

View File

@ -46,6 +46,7 @@ final class AioServerSocketChannelConfig extends DefaultChannelConfig
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T> T getOption(ChannelOption<T> option) { public <T> T getOption(ChannelOption<T> option) {
if (option == SO_RCVBUF) { if (option == SO_RCVBUF) {
return (T) Integer.valueOf(getReceiveBufferSize()); return (T) Integer.valueOf(getReceiveBufferSize());

View File

@ -326,7 +326,6 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
// This is needed as the ByteBuffer and the ByteBuf does not share // This is needed as the ByteBuffer and the ByteBuf does not share
// each others index // each others index
byteBuf.writerIndex(byteBuf.writerIndex() + localReadAmount); byteBuf.writerIndex(byteBuf.writerIndex() + localReadAmount);
expandReadBuffer(byteBuf);
read = true; read = true;
} else if (localReadAmount < 0) { } else if (localReadAmount < 0) {
@ -390,9 +389,9 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
@Override @Override
protected void completed0(Void result, AioSocketChannel channel) { protected void completed0(Void result, AioSocketChannel channel) {
channel.beginRead();
((AbstractAioUnsafe) channel.unsafe()).connectSuccess(); ((AbstractAioUnsafe) channel.unsafe()).connectSuccess();
channel.pipeline().fireChannelActive(); channel.pipeline().fireChannelActive();
channel.beginRead();
} }
@Override @Override

View File

@ -57,6 +57,7 @@ final class AioSocketChannelConfig extends DefaultChannelConfig
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T> T getOption(ChannelOption<T> option) { public <T> T getOption(ChannelOption<T> option) {
if (option == SO_RCVBUF) { if (option == SO_RCVBUF) {
return (T) Integer.valueOf(getReceiveBufferSize()); return (T) Integer.valueOf(getReceiveBufferSize());