Skip to content

Commit

Permalink
Ensure ChannelHandler.handlerAdded(...) is always called as first met…
Browse files Browse the repository at this point in the history
…hod of the handler

Motivation:

If a user adds a ChannelHandler from outside the EventLoop it is possible to get into the situation that handlerAdded(...) is scheduled on the EventLoop and so called after another methods of the ChannelHandler as the EventLoop may already be executing on this point in time.

Modification:

- Ensure we always check if the handlerAdded(...) method was called already and if not add the currently needed call to the EventLoop so it will be picked up after handlerAdded(...) was called. This works as if the handler is added to the ChannelPipeline from outside the EventLoop the actual handlerAdded(...) operation is scheduled on the EventLoop.
- Some cleanup in the DefaultChannelPipeline

Result:

Correctly order of method executions of ChannelHandler.
  • Loading branch information
normanmaurer committed Jan 28, 2016
1 parent a2732c6 commit af39cb6
Show file tree
Hide file tree
Showing 2 changed files with 337 additions and 38 deletions.

0 comments on commit af39cb6

Please sign in to comment.