mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-24 16:04:00 +08:00
* fix: when bytebuffer is not enough,we should wait for next instead of throw exception * fix: when bytebuffer is not enough,we should wait for next instead of throw exception
This commit is contained in:
@@ -432,8 +432,14 @@ public class CommitLog implements Swappable {
|
||||
public DispatchRequest checkMessageAndReturnSize(java.nio.ByteBuffer byteBuffer, final boolean checkCRC,
|
||||
final boolean checkDupInfo, final boolean readBody) {
|
||||
try {
|
||||
if (byteBuffer.remaining() <= 4) {
|
||||
return new DispatchRequest(-1, false /* fail */);
|
||||
}
|
||||
// 1 TOTAL SIZE
|
||||
int totalSize = byteBuffer.getInt();
|
||||
if (byteBuffer.remaining() < totalSize - 4) {
|
||||
return new DispatchRequest(-1, false /* fail */);
|
||||
}
|
||||
|
||||
// 2 MAGIC CODE
|
||||
int magicCode = byteBuffer.getInt();
|
||||
@@ -628,6 +634,7 @@ public class CommitLog implements Swappable {
|
||||
|
||||
return dispatchRequest;
|
||||
} catch (Exception e) {
|
||||
log.error("checkMessageAndReturnSize failed, may can not dispatch", e);
|
||||
}
|
||||
|
||||
return new DispatchRequest(-1, false /* success */);
|
||||
|
||||
Reference in New Issue
Block a user