Enabled keepalive for Windows (>= Vista)

This commit is contained in:
SChernykh 2023-07-17 09:49:10 +02:00
parent e7de104d88
commit 5717e72367
6 changed files with 28 additions and 6 deletions

View file

@ -50,6 +50,7 @@
#include "base/tools/Cvt.h"
#include "base/tools/cryptonote/BlobReader.h"
#include "net/JobResult.h"
#include "base/kernel/Platform.h"
#ifdef _MSC_VER
@ -567,9 +568,9 @@ void xmrig::Client::connect(const sockaddr *addr)
uv_tcp_init(uv_default_loop(), m_socket);
uv_tcp_nodelay(m_socket, 1);
# ifndef WIN32
uv_tcp_keepalive(m_socket, 1, 60);
# endif
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_socket, 1, 60);
}
uv_tcp_connect(req, m_socket, addr, onConnect);
}

View file

@ -46,6 +46,7 @@
#include "base/tools/Timer.h"
#include "base/tools/cryptonote/Signatures.h"
#include "net/JobResult.h"
#include "base/kernel/Platform.h"
#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_nodelay(s, 1);
# ifndef WIN32
uv_tcp_keepalive(s, 1, 60);
# endif
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(s, 1, 60);
}
if (m_pool.zmq_port() > 0) {
delete m_ZMQSocket;