openssl cleanup

This commit is contained in:
Benjamin Sergeant
2019-01-05 11:42:25 -08:00
parent c344913ae8
commit e892b21872
6 changed files with 131 additions and 63 deletions

View File

@ -36,6 +36,7 @@ namespace ix
virtual int recv(void* buffer, size_t length) final;
private:
void openSSLInitialize();
std::string getSSLError(int ret);
SSL_CTX* openSSLCreateContext(std::string& errMsg);
bool openSSLHandshake(const std::string& hostname, std::string& errMsg);
@ -48,6 +49,9 @@ namespace ix
SSL_CTX* _ssl_context;
const SSL_METHOD* _ssl_method;
mutable std::mutex _mutex; // OpenSSL routines are not thread-safe
std::once_flag _openSSLInitFlag;
static std::atomic<bool> _openSSLInitializationSuccessful;
};
}