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 4bf26c31e9
commit dfd7b0d6c3
2 changed files with 8 additions and 0 deletions

View File

@ -590,6 +590,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

@ -407,6 +407,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) {