Throw exception in case SSL is not enabled

This commit is contained in:
OmarBazaraa 2021-08-02 12:34:50 +00:00
parent 10d860acc3
commit 8577938efe

View File

@ -1,5 +1,7 @@
#include "StorageMongoDBSocketFactory.h"
#include <Common/Exception.h>
#if !defined(ARCADIA_BUILD)
# include <Common/config.h>
#endif
@ -15,6 +17,11 @@
namespace DB
{
namespace ErrorCodes
{
extern const int FEATURE_IS_NOT_ENABLED_AT_BUILD_TIME;
}
Poco::Net::StreamSocket StorageMongoDBSocketFactory::createSocket(const std::string & host, int port, Poco::Timespan connectTimeout, bool secure)
{
return secure ? createSecureSocket(host, port, connectTimeout) : createPlainSocket(host, port, connectTimeout);
@ -41,7 +48,7 @@ Poco::Net::StreamSocket StorageMongoDBSocketFactory::createSecureSocket(const st
return socket;
#else
return createPlainSocket(host, port, connectTimeout);
throw Exception("SSL is not enabled at build time.", ErrorCodes::FEATURE_IS_NOT_ENABLED_AT_BUILD_TIME);
#endif
}