diff --git a/src/base/net/stratum/Client.cpp b/src/base/net/stratum/Client.cpp index 06cc94fc..d780a5a8 100644 --- a/src/base/net/stratum/Client.cpp +++ b/src/base/net/stratum/Client.cpp @@ -344,6 +344,9 @@ bool xmrig::Client::close() setState(ClosingState); if (uv_is_closing(reinterpret_cast(m_socket)) == 0) { + if (Platform::hasKeepalive()) { + uv_tcp_keepalive(m_socket, 0, 60); + } uv_close(reinterpret_cast(m_socket), Client::onClose); } diff --git a/src/base/net/stratum/DaemonClient.cpp b/src/base/net/stratum/DaemonClient.cpp index b5e89d45..57d16685 100644 --- a/src/base/net/stratum/DaemonClient.cpp +++ b/src/base/net/stratum/DaemonClient.cpp @@ -590,6 +590,9 @@ void xmrig::DaemonClient::retry() } if ((m_ZMQConnectionState != ZMQ_NOT_CONNECTED) && (m_ZMQConnectionState != ZMQ_DISCONNECTING)) { + if (Platform::hasKeepalive()) { + uv_tcp_keepalive(m_ZMQSocket, 0, 60); + } uv_close(reinterpret_cast(m_ZMQSocket), onZMQClose); } @@ -917,6 +920,9 @@ bool xmrig::DaemonClient::ZMQClose(bool shutdown) m_ZMQConnectionState = ZMQ_DISCONNECTING; if (uv_is_closing(reinterpret_cast(m_ZMQSocket)) == 0) { + if (Platform::hasKeepalive()) { + uv_tcp_keepalive(m_ZMQSocket, 0, 60); + } uv_close(reinterpret_cast(m_ZMQSocket), shutdown ? onZMQShutdown : onZMQClose); if (!shutdown) { retry();