BewareMyPower commented on code in PR #551:
URL: https://github.com/apache/pulsar-client-cpp/pull/551#discussion_r2905807593
##########
lib/ClientConnection.cc:
##########
@@ -1297,16 +1321,24 @@ void ClientConnection::close(Result result, bool
detach) {
if (isClosed()) {
return;
}
- state_ = Disconnected;
if (socket_) {
ASIO_ERROR err;
- socket_->shutdown(ASIO::socket_base::shutdown_both, err);
- socket_->close(err);
- if (err) {
- LOG_WARN(cnxString_ << "Failed to close socket: " <<
err.message());
+ if (state_ != Pending) {
+ socket_->shutdown(ASIO::socket_base::shutdown_both, err);
+ socket_->close(err);
+ if (err) {
+ LOG_WARN(cnxString_ << "Failed to close socket: " <<
err.message());
+ }
+ } else {
+ // There is an ongoing connect operation, the socket will be
closed after the operation succeeds
+ // in `handleTcpConnected`
+ LOG_DEBUG(
+ cnxString_
Review Comment:
I used connection timeout instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]