mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
#1306 Added some network workarounds.
This commit is contained in:
parent
38d20ea5f4
commit
b8762ed428
1 changed files with 13 additions and 3 deletions
|
@ -338,6 +338,10 @@ bool xmrig::Client::isCriticalError(const char *message)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (strncasecmp(message, "Invalid job id", 14) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -558,7 +562,7 @@ void xmrig::Client::connect(sockaddr *addr)
|
|||
{
|
||||
setState(ConnectingState);
|
||||
|
||||
uv_connect_t *req = new uv_connect_t;
|
||||
auto req = new uv_connect_t;
|
||||
req->data = m_storage.ptr(m_key);
|
||||
|
||||
m_socket = new uv_tcp_t;
|
||||
|
@ -799,7 +803,7 @@ void xmrig::Client::ping()
|
|||
|
||||
void xmrig::Client::read(ssize_t nread)
|
||||
{
|
||||
const size_t size = static_cast<size_t>(nread);
|
||||
const auto size = static_cast<size_t>(nread);
|
||||
|
||||
if (nread > 0 && size > m_recvBuf.available()) {
|
||||
nread = UV_ENOBUFS;
|
||||
|
@ -859,7 +863,7 @@ void xmrig::Client::reconnect()
|
|||
|
||||
void xmrig::Client::setState(SocketState state)
|
||||
{
|
||||
LOG_DEBUG("[%s] state: \"%s\"", url(), states[state]);
|
||||
LOG_DEBUG("[%s] state: \"%s\" -> \"%s\"", url(), states[m_state], states[state]);
|
||||
|
||||
if (m_state == state) {
|
||||
return;
|
||||
|
@ -956,6 +960,12 @@ void xmrig::Client::onConnect(uv_connect_t *req, int status)
|
|||
return;
|
||||
}
|
||||
|
||||
if (client->state() == ConnectedState) {
|
||||
LOG_ERR("[%s] already connected");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
client->m_stream = static_cast<uv_stream_t*>(req->handle);
|
||||
client->m_stream->data = req->data;
|
||||
client->setState(ConnectedState);
|
||||
|
|
Loading…
Reference in a new issue