refactoring

pull/1990/head
Nikita Koksharov 6 years ago
parent 4ee3074dfe
commit 6ee48594b3

@ -102,17 +102,13 @@ public class CommandDecoder extends ReplayingDecoder<State> {
if (data == null) { if (data == null) {
while (in.writerIndex() > in.readerIndex()) { while (in.writerIndex() > in.readerIndex()) {
in.markReaderIndex();
skipCommand(in); skipCommand(in);
in.resetReaderIndex();
decode(ctx, in, data); decode(ctx, in, data);
} }
} else { } else {
if (!(data instanceof CommandsData)) { if (!(data instanceof CommandsData)) {
in.markReaderIndex();
skipCommand(in); skipCommand(in);
in.resetReaderIndex();
} }
decode(ctx, in, data); decode(ctx, in, data);
@ -155,7 +151,9 @@ public class CommandDecoder extends ReplayingDecoder<State> {
} }
protected void skipCommand(ByteBuf in) throws Exception { protected void skipCommand(ByteBuf in) throws Exception {
in.markReaderIndex();
skipDecode(in); skipDecode(in);
in.resetReaderIndex();
} }
protected void skipDecode(ByteBuf in) throws IOException{ protected void skipDecode(ByteBuf in) throws IOException{
@ -245,9 +243,7 @@ public class CommandDecoder extends ReplayingDecoder<State> {
checkpoint(); checkpoint();
state.get().setBatchIndex(i); state.get().setBatchIndex(i);
in.markReaderIndex();
skipCommand(in); skipCommand(in);
in.resetReaderIndex();
RedisCommand<?> cmd = commandBatch.getCommands().get(i).getCommand(); RedisCommand<?> cmd = commandBatch.getCommands().get(i).getCommand();
boolean skipConvertor = commandBatch.isQueued(); boolean skipConvertor = commandBatch.isQueued();

Loading…
Cancel
Save