Make sure writing empty ByteBuf will not cause a stavation.
This also fixes [#1436]
This commit is contained in:
parent
b1b1a906f0
commit
f2f6d68d2e
@ -125,6 +125,10 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
|||||||
|
|
||||||
if (msg instanceof ByteBuf) {
|
if (msg instanceof ByteBuf) {
|
||||||
ByteBuf buf = (ByteBuf) msg;
|
ByteBuf buf = (ByteBuf) msg;
|
||||||
|
if (!buf.isReadable()) {
|
||||||
|
buf.release();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
for (int i = config().getWriteSpinCount() - 1; i >= 0; i --) {
|
for (int i = config().getWriteSpinCount() - 1; i >= 0; i --) {
|
||||||
int localFlushedAmount = doWriteBytes(buf, i == 0);
|
int localFlushedAmount = doWriteBytes(buf, i == 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user