NPE in ConnectionWatchdog fixed

pull/653/head
Nikita 8 years ago
parent ad2da8d1c1
commit af18eb09a3

@ -65,13 +65,15 @@ public class ConnectionWatchdog extends ChannelInboundHandlerAdapter {
@Override @Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception { public void channelInactive(ChannelHandlerContext ctx) throws Exception {
RedisConnection connection = RedisConnection.getFrom(ctx.channel()); RedisConnection connection = RedisConnection.getFrom(ctx.channel());
connection.onDisconnect(); if (connection != null) {
if (!connection.isClosed()) { connection.onDisconnect();
if (connection.isFastReconnect()) { if (!connection.isClosed()) {
tryReconnect(connection, 1); if (connection.isFastReconnect()) {
connection.clearFastReconnect(); tryReconnect(connection, 1);
} else { connection.clearFastReconnect();
reconnect(connection, 1); } else {
reconnect(connection, 1);
}
} }
} }
ctx.fireChannelInactive(); ctx.fireChannelInactive();

Loading…
Cancel
Save