netty/netty — pull request #114 by chavdar (2011-12-10 23:07:49+00:00)
Title: 113 fix

A fix for https://github.com/netty/netty/issues/113

I believe the problem is in DefaultChannelPipeline.java:278-281 . name2ctx will not get updated if the handler name remains the same.

if (!sameName) {
name2ctx.remove(ctx.getName());
name2ctx.put(newName, newCtx);
}

Suggested fix is to move the put() outside the if statement:

if (!sameName) {
name2ctx.remove(ctx.getName());
}
name2ctx.put(newName, newCtx);

Commit also contains a unit test to demonstrate the original problem and verify the fix.