ReplayingDecoder should not complain when the state has been changed
This commit is contained in:
parent
d4348ab4d7
commit
7b69bf371b
@ -318,6 +318,7 @@ public abstract class ReplayingDecoder<T extends Enum<T>> extends SimpleChannelH
|
|||||||
while (cumulation.readable()) {
|
while (cumulation.readable()) {
|
||||||
int oldReaderIndex = checkpoint = cumulation.readerIndex();
|
int oldReaderIndex = checkpoint = cumulation.readerIndex();
|
||||||
Object result = null;
|
Object result = null;
|
||||||
|
T oldState = state;
|
||||||
try {
|
try {
|
||||||
result = decode(context, channel, replayable, state);
|
result = decode(context, channel, replayable, state);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
@ -341,7 +342,7 @@ public abstract class ReplayingDecoder<T extends Enum<T>> extends SimpleChannelH
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldReaderIndex == cumulation.readerIndex()) {
|
if (oldReaderIndex == cumulation.readerIndex() && oldState == state) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"decode() method must consume at least one byte "
|
"decode() method must consume at least one byte "
|
||||||
+ "if it returned a decoded message.");
|
+ "if it returned a decoded message.");
|
||||||
|
Loading…
Reference in New Issue
Block a user