Make sure we always cleanup once ReplayingDecoder handles a message. See #259
This commit is contained in:
parent
ec409751e1
commit
ccf01d133a
@ -293,6 +293,8 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
|
|||||||
private ReplayingDecoderBuffer replayable;
|
private ReplayingDecoderBuffer replayable;
|
||||||
private T state;
|
private T state;
|
||||||
private int checkpoint;
|
private int checkpoint;
|
||||||
|
private boolean needsCleanup;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance with no initial state (i.e: {@code null}).
|
* Creates a new instance with no initial state (i.e: {@code null}).
|
||||||
@ -429,6 +431,8 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
needsCleanup = true;
|
||||||
|
|
||||||
if (cumulation == null) {
|
if (cumulation == null) {
|
||||||
// the cumulation buffer is not created yet so just pass the input
|
// the cumulation buffer is not created yet so just pass the input
|
||||||
// to callDecode(...) method
|
// to callDecode(...) method
|
||||||
@ -570,8 +574,10 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
|
|||||||
throws Exception {
|
throws Exception {
|
||||||
try {
|
try {
|
||||||
ChannelBuffer cumulation = this.cumulation;
|
ChannelBuffer cumulation = this.cumulation;
|
||||||
if (cumulation == null) {
|
if (!needsCleanup) {
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
needsCleanup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cumulation = null;
|
this.cumulation = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user