Explorar o código

fix #262: closesocket if newSslCtx failed

ithewei %!s(int64=3) %!d(string=hai) anos
pai
achega
8ebd7cf059
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      evpp/TcpClient.h

+ 6 - 1
evpp/TcpClient.h

@@ -85,7 +85,12 @@ public:
         if (tls) {
             channel->enableSSL();
             if (tls_setting) {
-                channel->newSslCtx(tls_setting);
+                int ret = channel->newSslCtx(tls_setting);
+                if (ret != 0) {
+                    hloge("new SSL_CTX failed: %d", ret);
+                    closesocket();
+                    return ret;
+                }
             }
             if (!is_ipaddr(remote_host.c_str())) {
                 channel->setHostname(remote_host);