You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/06 22:38:30 UTC

[pulsar] branch master updated: C++ connection should fail fast if the TLS handshake fails (#4218)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new eff2874  C++ connection should fail fast if the TLS handshake fails (#4218)
eff2874 is described below

commit eff287496bfb37cb9335294d7415b1842a78bca1
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Tue May 7 00:38:26 2019 +0200

    C++ connection should fail fast if the TLS handshake fails (#4218)
---
 pulsar-client-cpp/lib/ClientConnection.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pulsar-client-cpp/lib/ClientConnection.cc b/pulsar-client-cpp/lib/ClientConnection.cc
index 086bfa8..43c5946 100644
--- a/pulsar-client-cpp/lib/ClientConnection.cc
+++ b/pulsar-client-cpp/lib/ClientConnection.cc
@@ -350,6 +350,12 @@ void ClientConnection::handleTcpConnected(const boost::system::error_code& err,
 }
 
 void ClientConnection::handleHandshake(const boost::system::error_code& err) {
+    if (err) {
+        LOG_ERROR(cnxString_ << "Handshake failed: " << err.message());
+        close();
+        return;
+    }
+
     bool connectingThroughProxy = logicalAddress_ != physicalAddress_;
     SharedBuffer buffer = Commands::newConnect(authentication_, logicalAddress_, connectingThroughProxy);
     // Send CONNECT command to broker