[#2494] Fix data curruption by ChannelTrafficShapingHandler
Motivation: ChannelTrafficShapingHandler may corrupt inbound data stream by scheduling the fireChannelRead event. Modification: Always call fireChannelRead(...) and only suspend reads after it Result: No more data corruption
This commit is contained in:
parent
13c0cfde59
commit
eb27cd279c
@ -245,17 +245,6 @@ public abstract class AbstractTrafficShapingHandler extends ChannelDuplexHandler
|
|||||||
}
|
}
|
||||||
ctx.executor().schedule(reopenTask, wait,
|
ctx.executor().schedule(reopenTask, wait,
|
||||||
TimeUnit.MILLISECONDS);
|
TimeUnit.MILLISECONDS);
|
||||||
} else {
|
|
||||||
// Create a Runnable to update the next handler in the chain. If one was create before it will
|
|
||||||
// just be reused to limit object creation
|
|
||||||
Runnable bufferUpdateTask = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ctx.fireChannelRead(msg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ctx.executor().schedule(bufferUpdateTask, wait, TimeUnit.MILLISECONDS);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user