Sync changes with proxy.

This commit is contained in:
XMRig 2018-10-09 02:32:29 +07:00
parent dda8157a7b
commit 9ef59366ba

View file

@ -259,7 +259,11 @@ int64_t Client::submit(const JobResult &result)
bool Client::close() bool Client::close()
{ {
if (m_state == UnconnectedState || m_state == ClosingState || !m_socket) { if (m_state == ClosingState) {
return m_socket != nullptr;
}
if (m_state == UnconnectedState || m_socket == nullptr) {
return false; return false;
} }
@ -426,7 +430,7 @@ bool Client::send(BIO *bio)
bool Client::verifyAlgorithm(const xmrig::Algorithm &algorithm) const bool Client::verifyAlgorithm(const xmrig::Algorithm &algorithm) const
{ {
# ifdef XMRIG_PROXY_PROJECT # ifdef XMRIG_PROXY_PROJECT
if (m_pool.algorithm().variant() == xmrig::VARIANT_AUTO) { if (m_pool.algorithm().variant() == xmrig::VARIANT_AUTO || m_id == -1) {
return true; return true;
} }
# endif # endif
@ -550,7 +554,6 @@ void Client::connect(sockaddr *addr)
setState(ConnectingState); setState(ConnectingState);
reinterpret_cast<sockaddr_in*>(addr)->sin_port = htons(m_pool.port()); reinterpret_cast<sockaddr_in*>(addr)->sin_port = htons(m_pool.port());
delete m_socket;
uv_connect_t *req = new uv_connect_t; uv_connect_t *req = new uv_connect_t;
req->data = m_storage.ptr(m_key); req->data = m_storage.ptr(m_key);
@ -831,13 +834,14 @@ void Client::reconnect()
return; return;
} }
setState(ConnectingState);
m_keepAlive = 0; m_keepAlive = 0;
if (m_failures == -1) { if (m_failures == -1) {
return m_listener->onClose(this, -1); return m_listener->onClose(this, -1);
} }
setState(ConnectingState);
m_failures++; m_failures++;
m_listener->onClose(this, (int) m_failures); m_listener->onClose(this, (int) m_failures);