diff --git a/src/main/java/org/xnio/netty/transport/AbstractXnioSocketChannel.java b/src/main/java/org/xnio/netty/transport/AbstractXnioSocketChannel.java index 97e82fe..2c78b93 100644 --- a/src/main/java/org/xnio/netty/transport/AbstractXnioSocketChannel.java +++ b/src/main/java/org/xnio/netty/transport/AbstractXnioSocketChannel.java @@ -178,6 +178,7 @@ protected void doWrite(ChannelOutboundBuffer in) throws Exception { } } + boolean byteBuffersOnly = true; if (done) { // Release all buffers for (int i = msgCount; i > 0; i --) { @@ -194,6 +195,10 @@ protected void doWrite(ChannelOutboundBuffer in) throws Exception { // Release the fully written buffers and update the indexes of the partially written buffer. for (int i = msgCount; i > 0; i --) { + if (in.current() != null && ! (in.current() instanceof ByteBuf)) { + byteBuffersOnly = false; + break; + } final ByteBuf buf = (ByteBuf) in.current(); final int readerIndex = buf.readerIndex(); final int readableBytes = buf.writerIndex() - readerIndex; @@ -212,14 +217,13 @@ protected void doWrite(ChannelOutboundBuffer in) throws Exception { break; } } - incompleteWrite(setOpWrite); break; } - continue; + if (byteBuffersOnly) + continue; } } - Object msg = in.current(); if (msg == null) { // Wrote all messages.