This commit is contained in:
commit
01e2945ab7
125 changed files with 4772 additions and 2073 deletions
|
@ -24,13 +24,14 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "base/io/log/backends/FileLog.h"
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
xmrig::FileLog::FileLog(const char *fileName)
|
||||
{
|
||||
uv_fs_t req;
|
||||
|
@ -45,13 +46,12 @@ void xmrig::FileLog::print(int, const char *line, size_t, size_t size, bool colo
|
|||
return;
|
||||
}
|
||||
|
||||
# ifdef _WIN32
|
||||
uv_buf_t buf = uv_buf_init(strdup(line), static_cast<unsigned int>(size));
|
||||
# else
|
||||
uv_buf_t buf = uv_buf_init(strdup(line), size);
|
||||
# endif
|
||||
assert(strlen(line) == size);
|
||||
|
||||
uv_fs_t *req = new uv_fs_t;
|
||||
uv_buf_t buf = uv_buf_init(new char[size], size);
|
||||
memcpy(buf.base, line, size);
|
||||
|
||||
auto req = new uv_fs_t;
|
||||
req->data = buf.base;
|
||||
|
||||
uv_fs_write(uv_default_loop(), req, m_file, &buf, 1, -1, FileLog::onWrite);
|
||||
|
|
|
@ -93,6 +93,8 @@ public:
|
|||
RandomXInitKey = 1022,
|
||||
RandomXNumaKey = 1023,
|
||||
RandomXModeKey = 1029,
|
||||
RandomX1GbPagesKey = 1031,
|
||||
RandomXWrmsrKey = 1032,
|
||||
CPUMaxThreadsKey = 1026,
|
||||
MemoryPoolKey = 1027,
|
||||
YieldKey = 1030,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue