mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-22 19:49:36 +00:00
Disable TCP keepalive before closing socket
This commit is contained in:
parent
64f5bb467a
commit
12577df7ba
2 changed files with 9 additions and 0 deletions
|
@ -344,6 +344,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -590,6 +590,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,6 +920,9 @@ 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();
|
||||||
|
|
Loading…
Reference in a new issue