Skip to content

Commit

Permalink
Merge pull request #1997, clienthandler in netty4 should trigger hear…
Browse files Browse the repository at this point in the history
…tbeat handler.

Fixes #1996 .
* Remove unuseful 'disconnect()' method since netty4
* trigger heartbeat
  • Loading branch information
zonghaishang authored and chickenlj committed Jun 29, 2018
1 parent 14ff830 commit c271039
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,16 @@ public NettyClientHandler(URL url, ChannelHandler handler) {

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelActive();
NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler);
try {
handler.connected(channel);
} finally {
NettyChannel.removeChannelIfDisconnected(ctx.channel());
}
}

@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelInactive();
}

@Override
public void disconnect(ChannelHandlerContext ctx, ChannelPromise future)
throws Exception {
NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler);
try {
handler.disconnected(channel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public Map<String, Channel> getChannels() {

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelActive();

NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler);
try {
if (channel != null) {
Expand All @@ -82,13 +80,6 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
}
}


@Override
public void disconnect(ChannelHandlerContext ctx, ChannelPromise future)
throws Exception {

}

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler);
Expand Down

0 comments on commit c271039

Please sign in to comment.