Skip to content

Commit

Permalink
xnio#14 At AbstractXnioSocketChannel.doWrite, skip loop if there is a…
Browse files Browse the repository at this point in the history
… non BytBuf message to handle it properly
  • Loading branch information
fl4via committed Sep 10, 2019
1 parent e01508f commit 27311c0
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 --) {
Expand All @@ -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;
Expand All @@ -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.
Expand Down

0 comments on commit 27311c0

Please sign in to comment.