mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 03:59:41 +00:00
Merge pull request #3302 from SChernykh/dev
Enabled keepalive for Windows (>= Vista)
This commit is contained in:
commit
64f5bb467a
6 changed files with 28 additions and 6 deletions
|
@ -49,6 +49,8 @@ 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; }
|
||||||
|
|
||||||
|
static bool hasKeepalive();
|
||||||
|
|
||||||
static bool isOnBatteryPower();
|
static bool isOnBatteryPower();
|
||||||
static uint64_t idleTime();
|
static uint64_t idleTime();
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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__
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,12 @@ char *xmrig::Platform::createUserAgent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Platform::hasKeepalive()
|
||||||
|
{
|
||||||
|
return winOsVersion().dwMajorVersion >= 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_FEATURE_HWLOC
|
#ifndef XMRIG_FEATURE_HWLOC
|
||||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "base/tools/Cvt.h"
|
#include "base/tools/Cvt.h"
|
||||||
#include "base/tools/cryptonote/BlobReader.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
|
||||||
|
@ -567,9 +568,9 @@ void xmrig::Client::connect(const sockaddr *addr)
|
||||||
uv_tcp_init(uv_default_loop(), m_socket);
|
uv_tcp_init(uv_default_loop(), m_socket);
|
||||||
uv_tcp_nodelay(m_socket, 1);
|
uv_tcp_nodelay(m_socket, 1);
|
||||||
|
|
||||||
# ifndef WIN32
|
if (Platform::hasKeepalive()) {
|
||||||
uv_tcp_keepalive(m_socket, 1, 60);
|
uv_tcp_keepalive(m_socket, 1, 60);
|
||||||
# endif
|
}
|
||||||
|
|
||||||
uv_tcp_connect(req, m_socket, addr, onConnect);
|
uv_tcp_connect(req, m_socket, addr, onConnect);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "base/tools/Timer.h"
|
#include "base/tools/Timer.h"
|
||||||
#include "base/tools/cryptonote/Signatures.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
|
||||||
|
@ -358,9 +359,9 @@ void xmrig::DaemonClient::onResolved(const DnsRecords &records, int status, cons
|
||||||
uv_tcp_init(uv_default_loop(), s);
|
uv_tcp_init(uv_default_loop(), s);
|
||||||
uv_tcp_nodelay(s, 1);
|
uv_tcp_nodelay(s, 1);
|
||||||
|
|
||||||
# ifndef WIN32
|
if (Platform::hasKeepalive()) {
|
||||||
uv_tcp_keepalive(s, 1, 60);
|
uv_tcp_keepalive(s, 1, 60);
|
||||||
# endif
|
}
|
||||||
|
|
||||||
if (m_pool.zmq_port() > 0) {
|
if (m_pool.zmq_port() > 0) {
|
||||||
delete m_ZMQSocket;
|
delete m_ZMQSocket;
|
||||||
|
|
Loading…
Reference in a new issue