Skip to content

Commit b1e7e49

Browse files
committed
fix(resp):修复BulkStrings解码状态机逻辑错误
- 在空字符串处理分支中添加缺失的break语句 - 调整长字符串处理分支中的break位置以避免重复执行 -修正状态机流转逻辑,确保各状态正确结束
1 parent 8444fb9 commit b1e7e49

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/tech/smartboot/redisun/resp/BulkStrings.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,19 @@ public boolean decode(ByteBuffer readBuffer) {
7676
// 空字符串
7777
state = DECODE_STATE_END;
7878
out = EMPTY_OUTPUT_STREAM;
79+
break;
7980
} else if (length > 0) {
8081
if (length + 2 <= readBuffer.capacity()) {
8182
state = DECODE_STATE_SIMPLE_VALUE;
8283
} else {
8384
// 初始化输出流以存储字符串数据
8485
out = new ByteArrayOutputStream(length);
8586
state = DECODE_STATE_LONG_VALUE;
87+
break;
8688
}
8789
} else {
8890
return false;
8991
}
90-
break;
9192
case DECODE_STATE_SIMPLE_VALUE: {
9293
if (readBuffer.remaining() < length + 2) {
9394
return false;

0 commit comments

Comments
 (0)