IovArray.add(...) should check if buffer has memory address.
Motivation: We currently not check if the buffer has a memory address and just assume this is the case if the nioBufferCount() == 1. Modifications: - Check hasMemoryAddress() before trying to access it. - Add unit case. Result: More correct and robust code. Related to [#7752].
This commit is contained in:
parent
bd772d127e
commit
f6251c8256
@ -91,7 +91,7 @@ public final class IovArray implements MessageProcessor {
|
|||||||
if (count == IOV_MAX) {
|
if (count == IOV_MAX) {
|
||||||
// No more room!
|
// No more room!
|
||||||
return false;
|
return false;
|
||||||
} else if (buf.nioBufferCount() == 1) {
|
} else if (buf.hasMemoryAddress() && buf.nioBufferCount() == 1) {
|
||||||
final int len = buf.readableBytes();
|
final int len = buf.readableBytes();
|
||||||
return len == 0 || add(buf.memoryAddress(), buf.readerIndex(), len);
|
return len == 0 || add(buf.memoryAddress(), buf.readerIndex(), len);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user