This commit is contained in:
MoneroOcean 2019-12-14 09:24:11 -08:00
commit 01e2945ab7
125 changed files with 4772 additions and 2073 deletions

View file

@ -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);

View file

@ -99,7 +99,7 @@ public:
# endif
static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); }
static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; }
static inline uint64_t toDiff(uint64_t target) { return target ? (0xFFFFFFFFFFFFFFFFULL / target) : 0; }
inline bool operator!=(const Job &other) const { return !isEqual(other); }
inline bool operator==(const Job &other) const { return isEqual(other); }