diff --git a/lib/cpp/src/thrift/TOutput.cpp b/lib/cpp/src/thrift/TOutput.cpp index 971e5dbf7b..72360afebf 100644 --- a/lib/cpp/src/thrift/TOutput.cpp +++ b/lib/cpp/src/thrift/TOutput.cpp @@ -31,7 +31,7 @@ namespace apache { namespace thrift { -THRIFT_EXPORT TOutput GlobalOutput; +/*THRIFT_EXPORT*/ TOutput GlobalOutput; // if you need this exported, build your own wrapper lib around and export it yourself TOutput::TOutput() : f_(&errorTimeWrapper) {} diff --git a/lib/cpp/src/thrift/TOutput.h b/lib/cpp/src/thrift/TOutput.h index 26c9a563ae..8a9061a198 100644 --- a/lib/cpp/src/thrift/TOutput.h +++ b/lib/cpp/src/thrift/TOutput.h @@ -20,7 +20,7 @@ #ifndef _THRIFT_OUTPUT_H_ #define _THRIFT_OUTPUT_H_ 1 -#include +//#include namespace apache { namespace thrift { @@ -53,7 +53,7 @@ class TOutput { void (*f_)(const char*); }; -THRIFT_EXPORT extern TOutput GlobalOutput; +/*THRIFT_EXPORT*/ extern TOutput GlobalOutput; // if you need this exported, build your own wrapper lib around and export it yourself } } // namespace apache::thrift diff --git a/lib/cpp/src/thrift/transport/TSSLServerSocket.cpp b/lib/cpp/src/thrift/transport/TSSLServerSocket.cpp index b20c174087..9e9fe976ea 100644 --- a/lib/cpp/src/thrift/transport/TSSLServerSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSSLServerSocket.cpp @@ -17,7 +17,7 @@ * under the License. */ -#include +//#include #include #include diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp index da8b027c6c..aaedf901af 100644 --- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp @@ -875,11 +875,13 @@ unsigned int TSSLSocket::waitForEvent(bool wantRead) { uint64_t TSSLSocketFactory::count_ = 0; Mutex TSSLSocketFactory::mutex_; bool TSSLSocketFactory::manualOpenSSLInitialization_ = false; +bool TSSLSocketFactory::didWeInitializeOpenSSL_ = false; TSSLSocketFactory::TSSLSocketFactory(SSLProtocol protocol) : server_(false) { Guard guard(mutex_); if (count_ == 0) { if (!manualOpenSSLInitialization_) { + didWeInitializeOpenSSL_ = true; initializeOpenSSL(); } randomize(); @@ -892,8 +894,9 @@ TSSLSocketFactory::~TSSLSocketFactory() { Guard guard(mutex_); ctx_.reset(); count_--; - if (count_ == 0 && !manualOpenSSLInitialization_) { + if (count_ == 0 && didWeInitializeOpenSSL_) { cleanupOpenSSL(); + didWeInitializeOpenSSL_ = false; } } diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.h b/lib/cpp/src/thrift/transport/TSSLSocket.h index 5afc571f99..80a68ceabd 100644 --- a/lib/cpp/src/thrift/transport/TSSLSocket.h +++ b/lib/cpp/src/thrift/transport/TSSLSocket.h @@ -327,7 +327,8 @@ class TSSLSocketFactory { std::shared_ptr access_; static concurrency::Mutex mutex_; static uint64_t count_; - THRIFT_EXPORT static bool manualOpenSSLInitialization_; + /*THRIFT_EXPORT*/ static bool manualOpenSSLInitialization_; // questionable to export a private member + static bool didWeInitializeOpenSSL_; // in that case we also perform de-init void setup(std::shared_ptr ssl); static int passwordCallback(char* password, int size, int, void* data); };