Fix a buf in CompositeChannelBuffer.setBytes() where -1 is not returned
This commit is contained in:
parent
ce4cf5e619
commit
6d5a332667
@ -508,13 +508,18 @@ public class CompositeChannelBuffer extends AbstractChannelBuffer {
|
||||
int localLength = Math.min(length, s.capacity() - (index - adjustment));
|
||||
int localReadBytes = s.setBytes(index - adjustment, in, localLength);
|
||||
|
||||
if (localReadBytes <= 0) {
|
||||
if (readBytes == 0) {
|
||||
readBytes = localReadBytes;
|
||||
}
|
||||
if (localReadBytes == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (localReadBytes < 0) {
|
||||
if (readBytes == 0) {
|
||||
return -1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (localReadBytes == localLength) {
|
||||
index += localLength;
|
||||
length -= localLength;
|
||||
|
Loading…
Reference in New Issue
Block a user