1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-10 17:12:46 -05:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Jean-Pierre De Jesus DIAZ
4ba4f07763 Merge f0f6d1666c into 64f5bb467a 2023-07-25 19:13:22 +08:00
9 changed files with 38 additions and 74 deletions

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -49,11 +49,7 @@ public:
static inline bool isUserActive(uint64_t ms) { return idleTime() < ms; } static inline bool isUserActive(uint64_t ms) { return idleTime() < ms; }
static inline const String &userAgent() { return m_userAgent; } static inline const String &userAgent() { return m_userAgent; }
# ifdef XMRIG_OS_WIN
static bool hasKeepalive(); static bool hasKeepalive();
# else
static constexpr bool hasKeepalive() { return true; }
# endif
static bool isOnBatteryPower(); static bool isOnBatteryPower();
static uint64_t idleTime(); static uint64_t idleTime();

View File

@@ -55,6 +55,12 @@ char *xmrig::Platform::createUserAgent()
} }
bool xmrig::Platform::hasKeepalive()
{
return true;
}
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{ {
return true; return true;

View File

@@ -70,6 +70,12 @@ char *xmrig::Platform::createUserAgent()
} }
bool xmrig::Platform::hasKeepalive()
{
return true;
}
#ifndef XMRIG_FEATURE_HWLOC #ifndef XMRIG_FEATURE_HWLOC
#ifdef __DragonFly__ #ifdef __DragonFly__

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <algorithm> #include <algorithm>
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>

View File

@@ -142,7 +142,7 @@ void xmrig::BaseConfig::printVersions()
snprintf(buf, sizeof buf, "MSVC/%d", MSVC_VERSION); snprintf(buf, sizeof buf, "MSVC/%d", MSVC_VERSION);
# endif # endif
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%s/%s") WHITE_BOLD(" %s") WHITE_BOLD(" (built for %s") WHITE_BOLD(" %s,") WHITE_BOLD(" %s)"), "ABOUT", APP_NAME, APP_VERSION, buf, APP_OS, APP_ARCH, APP_BITS); Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%s/%s") WHITE_BOLD(" %s"), "ABOUT", APP_NAME, APP_VERSION, buf);
std::string libs; std::string libs;

View File

@@ -1,7 +1,7 @@
/* XMRig /* XMRig
* Copyright (c) 2019 jtgrassie <https://github.com/jtgrassie> * Copyright (c) 2019 jtgrassie <https://github.com/jtgrassie>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -42,15 +42,15 @@
#include "base/io/json/JsonRequest.h" #include "base/io/json/JsonRequest.h"
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
#include "base/kernel/interfaces/IClientListener.h" #include "base/kernel/interfaces/IClientListener.h"
#include "base/kernel/Platform.h"
#include "base/net/dns/Dns.h" #include "base/net/dns/Dns.h"
#include "base/net/dns/DnsRecords.h" #include "base/net/dns/DnsRecords.h"
#include "base/net/stratum/Socks5.h" #include "base/net/stratum/Socks5.h"
#include "base/net/tools/NetBuffer.h" #include "base/net/tools/NetBuffer.h"
#include "base/tools/Chrono.h" #include "base/tools/Chrono.h"
#include "base/tools/cryptonote/BlobReader.h"
#include "base/tools/Cvt.h" #include "base/tools/Cvt.h"
#include "base/tools/cryptonote/BlobReader.h"
#include "net/JobResult.h" #include "net/JobResult.h"
#include "base/kernel/Platform.h"
#ifdef _MSC_VER #ifdef _MSC_VER
@@ -344,9 +344,6 @@ bool xmrig::Client::close()
setState(ClosingState); setState(ClosingState);
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_socket)) == 0) { if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_socket)) == 0) {
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_socket, 0, 60);
}
uv_close(reinterpret_cast<uv_handle_t*>(m_socket), Client::onClose); uv_close(reinterpret_cast<uv_handle_t*>(m_socket), Client::onClose);
} }

View File

@@ -1,13 +1,13 @@
/* XMRig /* XMRig
* Copyright (c) 2010 Jeff Garzik <jgarzik@pobox.com> * Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright (c) 2012-2014 pooler <pooler@litecoinpool.org> * Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright (c) 2014 Lucas Jones <https://github.com/lucasjones> * Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright (c) 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright (c) 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright (c) 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright (c) 2019 Howard Chu <https://github.com/hyc> * Copyright 2019 Howard Chu <https://github.com/hyc>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh> * Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <uv.h> #include <uv.h>
@@ -33,7 +34,6 @@
#include "base/io/json/JsonRequest.h" #include "base/io/json/JsonRequest.h"
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
#include "base/kernel/interfaces/IClientListener.h" #include "base/kernel/interfaces/IClientListener.h"
#include "base/kernel/Platform.h"
#include "base/net/dns/Dns.h" #include "base/net/dns/Dns.h"
#include "base/net/dns/DnsRecords.h" #include "base/net/dns/DnsRecords.h"
#include "base/net/http/Fetch.h" #include "base/net/http/Fetch.h"
@@ -42,10 +42,11 @@
#include "base/net/stratum/SubmitResult.h" #include "base/net/stratum/SubmitResult.h"
#include "base/net/tools/NetBuffer.h" #include "base/net/tools/NetBuffer.h"
#include "base/tools/bswap_64.h" #include "base/tools/bswap_64.h"
#include "base/tools/cryptonote/Signatures.h"
#include "base/tools/Cvt.h" #include "base/tools/Cvt.h"
#include "base/tools/Timer.h" #include "base/tools/Timer.h"
#include "base/tools/cryptonote/Signatures.h"
#include "net/JobResult.h" #include "net/JobResult.h"
#include "base/kernel/Platform.h"
#ifdef XMRIG_FEATURE_TLS #ifdef XMRIG_FEATURE_TLS
@@ -589,9 +590,6 @@ void xmrig::DaemonClient::retry()
} }
if ((m_ZMQConnectionState != ZMQ_NOT_CONNECTED) && (m_ZMQConnectionState != ZMQ_DISCONNECTING)) { if ((m_ZMQConnectionState != ZMQ_NOT_CONNECTED) && (m_ZMQConnectionState != ZMQ_DISCONNECTING)) {
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_ZMQSocket, 0, 60);
}
uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), onZMQClose); uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), onZMQClose);
} }
@@ -919,9 +917,6 @@ bool xmrig::DaemonClient::ZMQClose(bool shutdown)
m_ZMQConnectionState = ZMQ_DISCONNECTING; m_ZMQConnectionState = ZMQ_DISCONNECTING;
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_ZMQSocket)) == 0) { if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_ZMQSocket)) == 0) {
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_ZMQSocket, 0, 60);
}
uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), shutdown ? onZMQShutdown : onZMQClose); uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), shutdown ? onZMQShutdown : onZMQClose);
if (!shutdown) { if (!shutdown) {
retry(); retry();

View File

@@ -1,7 +1,7 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2020 tevador <tevador@gmail.com> * Copyright (c) 2018-2020 tevador <tevador@gmail.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crypto/common/VirtualMemory.h" #include "crypto/common/VirtualMemory.h"
#include "backend/cpu/Cpu.h" #include "backend/cpu/Cpu.h"
#include "crypto/common/portable/mm_malloc.h" #include "crypto/common/portable/mm_malloc.h"
@@ -24,7 +25,6 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include <fstream>
#include <sys/mman.h> #include <sys/mman.h>
@@ -84,9 +84,7 @@ static inline int hugePagesFlag(size_t size)
bool xmrig::VirtualMemory::isHugepagesAvailable() bool xmrig::VirtualMemory::isHugepagesAvailable()
{ {
# ifdef XMRIG_OS_LINUX # if defined(XMRIG_OS_MACOS) && defined(XMRIG_ARM)
return std::ifstream("/proc/sys/vm/nr_hugepages").good() || std::ifstream("/sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages").good();
# elif defined(XMRIG_OS_MACOS) && defined(XMRIG_ARM)
return false; return false;
# else # else
return true; return true;

View File

@@ -52,39 +52,4 @@
# endif # endif
#endif #endif
#ifdef XMRIG_OS_WIN
# define APP_OS "Windows"
#elif defined XMRIG_OS_IOS
# define APP_OS "iOS"
#elif defined XMRIG_OS_MACOS
# define APP_OS "macOS"
#elif defined XMRIG_OS_ANDROID
# define APP_OS "Android"
#elif defined XMRIG_OS_LINUX
# define APP_OS "Linux"
#elif defined XMRIG_OS_FREEBSD
# define APP_OS "FreeBSD"
#else
# define APP_OS "Unknown OS"
#endif
#define STR(X) #X
#define STR2(X) STR(X)
#ifdef XMRIG_ARM
# define APP_ARCH "ARMv" STR2(XMRIG_ARM)
#else
# if defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
# define APP_ARCH "x86-64"
# else
# define APP_ARCH "x86"
# endif
#endif
#ifdef XMRIG_64_BIT
# define APP_BITS "64 bit"
#else
# define APP_BITS "32 bit"
#endif
#endif // XMRIG_VERSION_H #endif // XMRIG_VERSION_H