|
|
|
@ -61,9 +61,8 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
|
|
|
|
|
private void sendPing(ChannelHandlerContext ctx) {
|
|
|
|
|
RedisConnection connection = RedisConnection.getFrom(ctx.channel());
|
|
|
|
|
CommandData<?, ?> commandData = connection.getCurrentCommand();
|
|
|
|
|
RFuture<String> future;
|
|
|
|
|
if ((commandData == null || !commandData.isBlockingCommand()) && !connection.isQueued()) {
|
|
|
|
|
if (connection.getUsage() == 0) {
|
|
|
|
|
future = connection.async(StringCodec.INSTANCE, RedisCommands.PING);
|
|
|
|
|
} else {
|
|
|
|
|
future = null;
|
|
|
|
@ -76,12 +75,6 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommandData<?, ?> commandData = connection.getCurrentCommand();
|
|
|
|
|
if (commandData != null && commandData.isBlockingCommand()) {
|
|
|
|
|
sendPing(ctx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (future != null
|
|
|
|
|
&& (future.cancel(false) || !future.isSuccess())) {
|
|
|
|
|
ctx.channel().close();
|
|
|
|
|