Close the connection but not the client (#13600)

* Close the connection but not the client

* Close the connection but not the client
This commit is contained in:
icodening 2024-01-19 18:19:57 +08:00 committed by GitHub
parent 7a3ad4ab41
commit 2cf54f7947
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -131,7 +131,8 @@ public class NettyConnectionClient extends AbstractConnectionClient {
NettyConfigOperator operator = new NettyConfigOperator(nettyChannel, getChannelHandler());
protocol.configClientPipeline(getUrl(), operator, nettySslContextOperator);
ch.closeFuture().addListener(channelFuture -> doClose());
// set null but do not close this client, it will be reconnect in the future
ch.closeFuture().addListener(channelFuture -> channel.set(null));
// TODO support Socks5
}
});
@ -150,9 +151,7 @@ public class NettyConnectionClient extends AbstractConnectionClient {
current.close();
}
this.channel.set(null);
if (!closePromise.isDone()) {
closePromise.setSuccess(null);
}
closePromise.setSuccess(null);
}
}

View File

@ -70,7 +70,9 @@ public class TriplePingPongHandler extends ChannelDuplexHandler {
@Override
public void run() {
ctx.close();
if (ctx.channel().isActive()) {
ctx.close();
}
}
}
}