NETTY-426 Prevent a user from reusing an upstream MessageEvent to write

something

Modified the pipeline implementations so that it rejects the attempt to
send an UpstreamMessageEvent to downstream
This commit is contained in:
Trustin Lee 2011-08-01 04:16:02 +09:00
parent bf41f4b099
commit fba8c7b7a4
2 changed files with 8 additions and 0 deletions

View File

@ -564,6 +564,10 @@ public class DefaultChannelPipeline implements ChannelPipeline {
}
void sendDownstream(DefaultChannelHandlerContext ctx, ChannelEvent e) {
if (e instanceof UpstreamMessageEvent) {
throw new IllegalArgumentException("cannot send an upstream event to downstream");
}
try {
((ChannelDownstreamHandler) ctx.getHandler()).handleDownstream(ctx, e);
} catch (Throwable t) {

View File

@ -381,6 +381,10 @@ public class StaticChannelPipeline implements ChannelPipeline {
}
void sendDownstream(StaticChannelHandlerContext ctx, ChannelEvent e) {
if (e instanceof UpstreamMessageEvent) {
throw new IllegalArgumentException("cannot send an upstream event to downstream");
}
try {
((ChannelDownstreamHandler) ctx.getHandler()).handleDownstream(ctx, e);
} catch (Throwable t) {