Use XMRIG_FEATURE_TLS instead of XMRIG_NO_TLS
This commit is contained in:
parent
5db458efd4
commit
034720e888
8 changed files with 19 additions and 31 deletions
|
@ -18,12 +18,10 @@ if (WITH_TLS)
|
|||
endif()
|
||||
|
||||
add_definitions(/DXMRIG_FEATURE_TLS)
|
||||
remove_definitions(/DXMRIG_NO_TLS)
|
||||
else()
|
||||
set(TLS_SOURCES "")
|
||||
set(OPENSSL_LIBRARIES "")
|
||||
remove_definitions(/DXMRIG_FEATURE_TLS)
|
||||
add_definitions(/DXMRIG_NO_TLS)
|
||||
|
||||
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
|
||||
endif()
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#ifdef XMRIG_FEATURE_TLS
|
||||
# include <openssl/opensslv.h>
|
||||
#endif
|
||||
|
||||
|
@ -77,7 +77,7 @@ static int showVersion()
|
|||
printf("microhttpd/%s\n", MHD_get_version());
|
||||
# endif
|
||||
|
||||
# if !defined(XMRIG_NO_TLS) && defined(OPENSSL_VERSION_TEXT)
|
||||
# if defined(XMRIG_FEATURE_TLS) && defined(OPENSSL_VERSION_TEXT)
|
||||
{
|
||||
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
||||
printf("OpenSSL/%.*s\n", static_cast<int>(strchr(v, ' ') - v), v);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <utility>
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#ifdef XMRIG_FEATURE_TLS
|
||||
# include <openssl/ssl.h>
|
||||
# include <openssl/err.h>
|
||||
# include "base/net/stratum/Tls.h"
|
||||
|
@ -107,7 +107,7 @@ xmrig::Client::~Client()
|
|||
|
||||
void xmrig::Client::connect()
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (m_pool.isTLS()) {
|
||||
m_tls = new Tls(this);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ bool xmrig::Client::disconnect()
|
|||
|
||||
bool xmrig::Client::isTLS() const
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
return m_pool.isTLS() && m_tls;
|
||||
# else
|
||||
return false;
|
||||
|
@ -194,7 +194,7 @@ bool xmrig::Client::isTLS() const
|
|||
|
||||
const char *xmrig::Client::tlsFingerprint() const
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (isTLS() && m_pool.fingerprint() == nullptr) {
|
||||
return m_tls->fingerprint();
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ const char *xmrig::Client::tlsFingerprint() const
|
|||
|
||||
const char *xmrig::Client::tlsVersion() const
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (isTLS()) {
|
||||
return m_tls->version();
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ bool xmrig::Client::parseLogin(const rapidjson::Value &result, int *code)
|
|||
|
||||
bool xmrig::Client::send(BIO *bio)
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
uv_buf_t buf;
|
||||
buf.len = BIO_get_mem_data(bio, &buf.base);
|
||||
|
||||
|
@ -543,7 +543,7 @@ int64_t xmrig::Client::send(size_t size)
|
|||
{
|
||||
LOG_DEBUG("[%s] send (%d bytes): \"%s\"", url(), size, m_sendBuf);
|
||||
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (isTLS()) {
|
||||
if (!m_tls->send(m_sendBuf, size)) {
|
||||
return -1;
|
||||
|
@ -597,7 +597,7 @@ void xmrig::Client::connect(sockaddr *addr)
|
|||
|
||||
void xmrig::Client::handshake()
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (isTLS()) {
|
||||
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
|
||||
|
||||
|
@ -661,7 +661,7 @@ void xmrig::Client::onClose()
|
|||
m_socket = nullptr;
|
||||
setState(UnconnectedState);
|
||||
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (m_tls) {
|
||||
delete m_tls;
|
||||
m_tls = nullptr;
|
||||
|
@ -858,7 +858,7 @@ void xmrig::Client::read(ssize_t nread)
|
|||
|
||||
m_recvBuf.nread(size);
|
||||
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
if (isTLS()) {
|
||||
LOG_DEBUG("[%s] TLS received (%d bytes)", url(), static_cast<int>(nread));
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
constexpr static int kResponseTimeout = 20 * 1000;
|
||||
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
constexpr static int kInputBufferSize = 1024 * 16;
|
||||
# else
|
||||
constexpr static int kInputBufferSize = 1024 * 2;
|
||||
|
|
|
@ -178,7 +178,7 @@ bool xmrig::Pool::isCompatible(const Algorithm &algorithm) const
|
|||
|
||||
bool xmrig::Pool::isEnabled() const
|
||||
{
|
||||
# ifdef XMRIG_NO_TLS
|
||||
# ifndef XMRIG_FEATURE_TLS
|
||||
if (isTLS()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#ifdef XMRIG_FEATURE_TLS
|
||||
# include <openssl/ssl.h>
|
||||
# include <openssl/err.h>
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@ xmrig::String Platform::m_userAgent;
|
|||
|
||||
void Platform::init(const char *userAgent)
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
SSL_library_init();
|
||||
SSL_load_error_strings();
|
||||
ERR_load_BIO_strings();
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#ifdef XMRIG_FEATURE_TLS
|
||||
# include <openssl/opensslv.h>
|
||||
#endif
|
||||
|
||||
|
@ -131,12 +131,12 @@ void xmrig::CommonConfig::printVersions()
|
|||
# else
|
||||
memset(buf, 0, 16);
|
||||
|
||||
# if !defined(XMRIG_NO_HTTPD) || !defined(XMRIG_NO_TLS)
|
||||
# if !defined(XMRIG_NO_HTTPD) || defined(XMRIG_FEATURE_TLS)
|
||||
int length = 0;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(XMRIG_NO_TLS) && defined(OPENSSL_VERSION_TEXT)
|
||||
# if defined(XMRIG_FEATURE_TLS) && defined(OPENSSL_VERSION_TEXT)
|
||||
{
|
||||
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
||||
length += snprintf(buf + length, (sizeof buf) - length, "OpenSSL/%.*s ", static_cast<int>(strchr(v, ' ') - v), v);
|
||||
|
|
|
@ -29,16 +29,6 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_HTTPD
|
||||
# include <microhttpd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_TLS
|
||||
# include <openssl/opensslv.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "base/io/Json.h"
|
||||
#include "base/kernel/interfaces/IConfigListener.h"
|
||||
#include "base/kernel/Process.h"
|
||||
|
|
Loading…
Reference in a new issue