mirror of
https://github.com/xmrig/xmrig.git
synced 2026-04-30 09:12:39 -04:00
Merge xmrig v6.7.0 into master
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -50,20 +44,9 @@ xmrig::Console::Console(IConsoleListener *listener)
|
||||
|
||||
xmrig::Console::~Console()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Console::stop()
|
||||
{
|
||||
if (!m_tty) {
|
||||
return;
|
||||
}
|
||||
|
||||
uv_tty_reset_mode();
|
||||
|
||||
Handle::close(m_tty);
|
||||
m_tty = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,7 +23,16 @@
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
using uv_buf_t = struct uv_buf_t;
|
||||
using uv_handle_t = struct uv_handle_s;
|
||||
using uv_stream_t = struct uv_stream_s;
|
||||
using uv_tty_t = struct uv_tty_s;
|
||||
|
||||
#ifdef XMRIG_OS_WIN
|
||||
using ssize_t = intptr_t;
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -46,8 +49,6 @@ public:
|
||||
Console(IConsoleListener *listener);
|
||||
~Console();
|
||||
|
||||
void stop();
|
||||
|
||||
private:
|
||||
bool isSupported() const;
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,23 +17,30 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "base/io/Signals.h"
|
||||
#include "base/kernel/interfaces/ISignalListener.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/io/Signals.h"
|
||||
#include "base/tools/Handle.h"
|
||||
|
||||
|
||||
#ifdef SIGUSR1
|
||||
static const int signums[xmrig::Signals::kSignalsCount] = { SIGHUP, SIGINT, SIGTERM, SIGUSR1 };
|
||||
#else
|
||||
static const int signums[xmrig::Signals::kSignalsCount] = { SIGHUP, SIGINT, SIGTERM };
|
||||
#endif
|
||||
|
||||
|
||||
xmrig::Signals::Signals(ISignalListener *listener)
|
||||
: m_listener(listener)
|
||||
{
|
||||
# ifndef XMRIG_OS_WIN
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
# endif
|
||||
|
||||
for (size_t i = 0; i < kSignalsCount; ++i) {
|
||||
uv_signal_t *signal = new uv_signal_t;
|
||||
signal->data = this;
|
||||
auto signal = new uv_signal_t;
|
||||
signal->data = this;
|
||||
|
||||
m_signals[i] = signal;
|
||||
|
||||
@@ -51,24 +52,37 @@ xmrig::Signals::Signals(ISignalListener *listener)
|
||||
|
||||
xmrig::Signals::~Signals()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Signals::stop()
|
||||
{
|
||||
if (!m_signals[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < kSignalsCount; ++i) {
|
||||
Handle::close(m_signals[i]);
|
||||
m_signals[i] = nullptr;
|
||||
for (auto signal : m_signals) {
|
||||
Handle::close(signal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Signals::onSignal(uv_signal_t *handle, int signum)
|
||||
{
|
||||
switch (signum)
|
||||
{
|
||||
case SIGHUP:
|
||||
LOG_WARN("%s " YELLOW("SIGHUP received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
case SIGTERM:
|
||||
LOG_WARN("%s " YELLOW("SIGTERM received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
case SIGINT:
|
||||
LOG_WARN("%s " YELLOW("SIGINT received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
# ifdef SIGUSR1
|
||||
case SIGUSR1:
|
||||
LOG_V5("%s " WHITE_BOLD("SIGUSR1 received"), Tags::signal());
|
||||
break;
|
||||
# endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
static_cast<Signals *>(handle->data)->m_listener->onSignal(signum);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,10 +20,14 @@
|
||||
#define XMRIG_SIGNALS_H
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
typedef struct uv_signal_s uv_signal_t;
|
||||
#include <csignal>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
using uv_signal_t = struct uv_signal_s;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -41,20 +39,24 @@ class ISignalListener;
|
||||
class Signals
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Signals)
|
||||
|
||||
# ifdef SIGUSR1
|
||||
constexpr static const size_t kSignalsCount = 4;
|
||||
# else
|
||||
constexpr static const size_t kSignalsCount = 3;
|
||||
# endif
|
||||
|
||||
Signals(ISignalListener *listener);
|
||||
~Signals();
|
||||
|
||||
void stop();
|
||||
|
||||
private:
|
||||
void close(int signum);
|
||||
|
||||
static void onSignal(uv_signal_t *handle, int signum);
|
||||
|
||||
ISignalListener *m_listener;
|
||||
uv_signal_t *m_signals[kSignalsCount];
|
||||
uv_signal_t *m_signals[kSignalsCount]{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,6 +23,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <istream>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -119,6 +114,21 @@ const rapidjson::Value &xmrig::Json::getValue(const rapidjson::Value &obj, const
|
||||
}
|
||||
|
||||
|
||||
double xmrig::Json::getDouble(const rapidjson::Value &obj, const char *key, double defaultValue)
|
||||
{
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && (i->value.IsDouble() || i->value.IsLosslessDouble())) {
|
||||
return i->value.GetDouble();
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
int xmrig::Json::getInt(const rapidjson::Value &obj, const char *key, int defaultValue)
|
||||
{
|
||||
if (isEmpty(obj)) {
|
||||
@@ -149,6 +159,25 @@ int64_t xmrig::Json::getInt64(const rapidjson::Value &obj, const char *key, int6
|
||||
}
|
||||
|
||||
|
||||
xmrig::String xmrig::Json::getString(const rapidjson::Value &obj, const char *key, size_t maxSize)
|
||||
{
|
||||
if (isEmpty(obj)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i == obj.MemberEnd() || !i->value.IsString()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (maxSize == 0 || i->value.GetStringLength() <= maxSize) {
|
||||
return i->value.GetString();
|
||||
}
|
||||
|
||||
return { i->value.GetString(), maxSize };
|
||||
}
|
||||
|
||||
|
||||
uint64_t xmrig::Json::getUint64(const rapidjson::Value &obj, const char *key, uint64_t defaultValue)
|
||||
{
|
||||
if (isEmpty(obj)) {
|
||||
@@ -222,6 +251,11 @@ bool xmrig::Json::convertOffset(std::istream &ifs, size_t offset, size_t &line,
|
||||
}
|
||||
|
||||
|
||||
xmrig::JsonReader::JsonReader() :
|
||||
m_obj(kNullValue)
|
||||
{}
|
||||
|
||||
|
||||
bool xmrig::JsonReader::isEmpty() const
|
||||
{
|
||||
return Json::isEmpty(m_obj);
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,13 +20,10 @@
|
||||
#define XMRIG_JSON_H
|
||||
|
||||
|
||||
#include "3rdparty/rapidjson/fwd.h"
|
||||
#include "base/kernel/interfaces/IJsonReader.h"
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -47,8 +38,10 @@ public:
|
||||
static const rapidjson::Value &getArray(const rapidjson::Value &obj, const char *key);
|
||||
static const rapidjson::Value &getObject(const rapidjson::Value &obj, const char *key);
|
||||
static const rapidjson::Value &getValue(const rapidjson::Value &obj, const char *key);
|
||||
static double getDouble(const rapidjson::Value &obj, const char *key, double defaultValue = 0);
|
||||
static int getInt(const rapidjson::Value &obj, const char *key, int defaultValue = 0);
|
||||
static int64_t getInt64(const rapidjson::Value &obj, const char *key, int64_t defaultValue = 0);
|
||||
static String getString(const rapidjson::Value &obj, const char *key, size_t maxSize);
|
||||
static uint64_t getUint64(const rapidjson::Value &obj, const char *key, uint64_t defaultValue = 0);
|
||||
static unsigned getUint(const rapidjson::Value &obj, const char *key, unsigned defaultValue = 0);
|
||||
|
||||
@@ -66,6 +59,7 @@ private:
|
||||
class JsonReader : public IJsonReader
|
||||
{
|
||||
public:
|
||||
JsonReader();
|
||||
inline JsonReader(const rapidjson::Value &obj) : m_obj(obj) {}
|
||||
|
||||
inline bool getBool(const char *key, bool defaultValue = false) const override { return Json::getBool(m_obj, key, defaultValue); }
|
||||
@@ -73,8 +67,11 @@ public:
|
||||
inline const rapidjson::Value &getArray(const char *key) const override { return Json::getArray(m_obj, key); }
|
||||
inline const rapidjson::Value &getObject(const char *key) const override { return Json::getObject(m_obj, key); }
|
||||
inline const rapidjson::Value &getValue(const char *key) const override { return Json::getValue(m_obj, key); }
|
||||
inline const rapidjson::Value &object() const override { return m_obj; }
|
||||
inline double getDouble(const char *key, double defaultValue = 0) const override { return Json::getDouble(m_obj, key, defaultValue); }
|
||||
inline int getInt(const char *key, int defaultValue = 0) const override { return Json::getInt(m_obj, key, defaultValue); }
|
||||
inline int64_t getInt64(const char *key, int64_t defaultValue = 0) const override { return Json::getInt64(m_obj, key, defaultValue); }
|
||||
inline String getString(const char *key, size_t maxSize) const override { return Json::getString(m_obj, key, maxSize); }
|
||||
inline uint64_t getUint64(const char *key, uint64_t defaultValue = 0) const override { return Json::getUint64(m_obj, key, defaultValue); }
|
||||
inline unsigned getUint(const char *key, unsigned defaultValue = 0) const override { return Json::getUint(m_obj, key, defaultValue); }
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -181,6 +175,28 @@ const rapidjson::Value &xmrig::JsonChain::getValue(const char *key) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
const rapidjson::Value &xmrig::JsonChain::object() const
|
||||
{
|
||||
assert(false);
|
||||
|
||||
return m_chain.back();
|
||||
}
|
||||
|
||||
|
||||
double xmrig::JsonChain::getDouble(const char *key, double defaultValue) const
|
||||
{
|
||||
for (auto it = m_chain.rbegin(); it != m_chain.rend(); ++it) {
|
||||
auto i = it->FindMember(key);
|
||||
if (i != it->MemberEnd() && (i->value.IsDouble() || i->value.IsLosslessDouble())) {
|
||||
return i->value.GetDouble();
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
int xmrig::JsonChain::getInt(const char *key, int defaultValue) const
|
||||
{
|
||||
for (auto it = m_chain.rbegin(); it != m_chain.rend(); ++it) {
|
||||
@@ -207,6 +223,24 @@ int64_t xmrig::JsonChain::getInt64(const char *key, int64_t defaultValue) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
xmrig::String xmrig::JsonChain::getString(const char *key, size_t maxSize) const
|
||||
{
|
||||
for (auto it = m_chain.rbegin(); it != m_chain.rend(); ++it) {
|
||||
auto i = it->FindMember(key);
|
||||
if (i != it->MemberEnd() && i->value.IsString()) {
|
||||
if (maxSize == 0 || i->value.GetStringLength() <= maxSize) {
|
||||
return i->value.GetString();
|
||||
}
|
||||
|
||||
return { i->value.GetString(), maxSize };
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
uint64_t xmrig::JsonChain::getUint64(const char *key, uint64_t defaultValue) const
|
||||
{
|
||||
for (auto it = m_chain.rbegin(); it != m_chain.rend(); ++it) {
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -59,8 +53,11 @@ protected:
|
||||
const rapidjson::Value &getArray(const char *key) const override;
|
||||
const rapidjson::Value &getObject(const char *key) const override;
|
||||
const rapidjson::Value &getValue(const char *key) const override;
|
||||
const rapidjson::Value &object() const override;
|
||||
double getDouble(const char *key, double defaultValue = 0) const override;
|
||||
int getInt(const char *key, int defaultValue = 0) const override;
|
||||
int64_t getInt64(const char *key, int64_t defaultValue = 0) const override;
|
||||
String getString(const char *key, size_t maxSize) const override;
|
||||
uint64_t getUint64(const char *key, uint64_t defaultValue = 0) const override;
|
||||
unsigned getUint(const char *key, unsigned defaultValue = 0) const override;
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,16 +24,33 @@
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static const char *k2_0 = "2.0";
|
||||
static const char *kId = "id";
|
||||
static const char *kJsonRPC = "jsonrpc";
|
||||
static const char *kMethod = "method";
|
||||
const char *JsonRequest::kParams = "params";
|
||||
const char *JsonRequest::k2_0 = "2.0";
|
||||
const char *JsonRequest::kId = "id";
|
||||
const char *JsonRequest::kJsonRPC = "jsonrpc";
|
||||
const char *JsonRequest::kMethod = "method";
|
||||
const char *JsonRequest::kOK = "OK";
|
||||
const char *JsonRequest::kParams = "params";
|
||||
const char *JsonRequest::kResult = "result";
|
||||
const char *JsonRequest::kStatus = "status";
|
||||
|
||||
const char *JsonRequest::kParseError = "parse error";
|
||||
const char *JsonRequest::kInvalidRequest = "invalid request";
|
||||
const char *JsonRequest::kMethodNotFound = "method not found";
|
||||
const char *JsonRequest::kInvalidParams = "invalid params";
|
||||
const char *JsonRequest::kInternalError = "internal error";
|
||||
|
||||
static uint64_t nextId = 0;
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
rapidjson::Document xmrig::JsonRequest::create(const char *method)
|
||||
{
|
||||
return create(++nextId, method);
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Document xmrig::JsonRequest::create(int64_t id, const char *method)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
@@ -54,7 +65,13 @@ rapidjson::Document xmrig::JsonRequest::create(int64_t id, const char *method)
|
||||
}
|
||||
|
||||
|
||||
void xmrig::JsonRequest::create(rapidjson::Document &doc, int64_t id, const char *method, rapidjson::Value ¶ms)
|
||||
uint64_t xmrig::JsonRequest::create(rapidjson::Document &doc, const char *method, rapidjson::Value ¶ms)
|
||||
{
|
||||
return create(doc, ++nextId, method, params);
|
||||
}
|
||||
|
||||
|
||||
uint64_t xmrig::JsonRequest::create(rapidjson::Document &doc, int64_t id, const char *method, rapidjson::Value ¶ms)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
@@ -63,4 +80,6 @@ void xmrig::JsonRequest::create(rapidjson::Document &doc, int64_t id, const char
|
||||
doc.AddMember(StringRef(kJsonRPC), StringRef(k2_0), allocator);
|
||||
doc.AddMember(StringRef(kMethod), StringRef(method), allocator);
|
||||
doc.AddMember(StringRef(kParams), params, allocator);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -35,10 +29,31 @@ namespace xmrig {
|
||||
class JsonRequest
|
||||
{
|
||||
public:
|
||||
static const char *k2_0;
|
||||
static const char *kId;
|
||||
static const char *kJsonRPC;
|
||||
static const char *kMethod;
|
||||
static const char *kOK;
|
||||
static const char *kParams;
|
||||
static const char *kResult;
|
||||
static const char *kStatus;
|
||||
|
||||
static const char *kParseError;
|
||||
static const char *kInvalidRequest;
|
||||
static const char *kMethodNotFound;
|
||||
static const char *kInvalidParams;
|
||||
static const char *kInternalError;
|
||||
|
||||
constexpr static int kParseErrorCode = -32700;
|
||||
constexpr static int kInvalidRequestCode = -32600;
|
||||
constexpr static int kMethodNotFoundCode = -32601;
|
||||
constexpr static int kInvalidParamsCode = -32602;
|
||||
constexpr static int kInternalErrorCode = -32603;
|
||||
|
||||
static rapidjson::Document create(const char *method);
|
||||
static rapidjson::Document create(int64_t id, const char *method);
|
||||
static void create(rapidjson::Document &doc, int64_t id, const char *method, rapidjson::Value ¶ms);
|
||||
static uint64_t create(rapidjson::Document &doc, const char *method, rapidjson::Value ¶ms);
|
||||
static uint64_t create(rapidjson::Document &doc, int64_t id, const char *method, rapidjson::Value ¶ms);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -43,7 +37,7 @@ bool xmrig::Json::get(const char *fileName, rapidjson::Document &doc)
|
||||
rapidjson::IStreamWrapper isw(ifs);
|
||||
doc.ParseStream<rapidjson::kParseCommentsFlag | rapidjson::kParseTrailingCommasFlag>(isw);
|
||||
|
||||
return !doc.HasParseError() && doc.IsObject();
|
||||
return !doc.HasParseError() && (doc.IsObject() || doc.IsArray());
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +50,10 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
|
||||
|
||||
rapidjson::OStreamWrapper osw(ofs);
|
||||
rapidjson::PrettyWriter<rapidjson::OStreamWrapper> writer(osw);
|
||||
|
||||
# ifdef XMRIG_JSON_SINGLE_LINE_ARRAY
|
||||
writer.SetFormatOptions(rapidjson::kFormatSingleLineArray);
|
||||
# endif
|
||||
|
||||
doc.Accept(writer);
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -96,7 +90,7 @@ bool xmrig::Json::get(const char *fileName, rapidjson::Document &doc)
|
||||
IStreamWrapper isw(ifs);
|
||||
doc.ParseStream<kParseCommentsFlag | kParseTrailingCommasFlag>(isw);
|
||||
|
||||
return !doc.HasParseError() && doc.IsObject();
|
||||
return !doc.HasParseError() && (doc.IsObject() || doc.IsArray());
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +121,10 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
|
||||
|
||||
OStreamWrapper osw(ofs);
|
||||
PrettyWriter<OStreamWrapper> writer(osw);
|
||||
|
||||
# ifdef XMRIG_JSON_SINGLE_LINE_ARRAY
|
||||
writer.SetFormatOptions(kFormatSingleLineArray);
|
||||
# endif
|
||||
|
||||
doc.Accept(writer);
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,6 +25,7 @@
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <mutex>
|
||||
@@ -76,7 +71,7 @@ public:
|
||||
|
||||
inline ~LogPrivate()
|
||||
{
|
||||
for (ILogBackend *backend : m_backends) {
|
||||
for (auto backend : m_backends) {
|
||||
delete backend;
|
||||
}
|
||||
}
|
||||
@@ -96,7 +91,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
timestamp(level, size, offset);
|
||||
const uint64_t ts = timestamp(level, size, offset);
|
||||
color(level, size);
|
||||
|
||||
const int rc = vsnprintf(m_buf + size, sizeof (m_buf) - offset - 32, fmt, args);
|
||||
@@ -114,9 +109,9 @@ public:
|
||||
}
|
||||
|
||||
if (!m_backends.empty()) {
|
||||
for (ILogBackend *backend : m_backends) {
|
||||
backend->print(level, m_buf, offset, size, true);
|
||||
backend->print(level, txt.c_str(), offset ? (offset - 11) : 0, txt.size(), false);
|
||||
for (auto backend : m_backends) {
|
||||
backend->print(ts, level, m_buf, offset, size, true);
|
||||
backend->print(ts, level, txt.c_str(), offset ? (offset - 11) : 0, txt.size(), false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -127,14 +122,15 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
inline void timestamp(Log::Level level, size_t &size, size_t &offset)
|
||||
inline uint64_t timestamp(Log::Level level, size_t &size, size_t &offset)
|
||||
{
|
||||
const uint64_t ms = Chrono::currentMSecsSinceEpoch();
|
||||
|
||||
if (level == Log::NONE) {
|
||||
return;
|
||||
return ms;
|
||||
}
|
||||
|
||||
const uint64_t ms = Chrono::currentMSecsSinceEpoch();
|
||||
time_t now = ms / 1000;
|
||||
time_t now = ms / 1000;
|
||||
tm stime{};
|
||||
|
||||
# ifdef _WIN32
|
||||
@@ -156,6 +152,8 @@ private:
|
||||
if (rc > 0) {
|
||||
size = offset = static_cast<size_t>(rc);
|
||||
}
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,10 +193,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
bool Log::m_background = false;
|
||||
bool Log::m_colors = true;
|
||||
LogPrivate *Log::d = new LogPrivate();
|
||||
uint32_t Log::m_verbose = 0;
|
||||
bool Log::m_background = false;
|
||||
bool Log::m_colors = true;
|
||||
LogPrivate *Log::d = nullptr;
|
||||
uint32_t Log::m_verbose = 0;
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
@@ -207,6 +205,8 @@ uint32_t Log::m_verbose = 0;
|
||||
|
||||
void xmrig::Log::add(ILogBackend *backend)
|
||||
{
|
||||
assert(d != nullptr);
|
||||
|
||||
if (d) {
|
||||
d->add(backend);
|
||||
}
|
||||
@@ -220,6 +220,12 @@ void xmrig::Log::destroy()
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Log::init()
|
||||
{
|
||||
d = new LogPrivate();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Log::print(const char *fmt, ...)
|
||||
{
|
||||
if (!d) {
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -57,6 +51,7 @@ public:
|
||||
|
||||
static void add(ILogBackend *backend);
|
||||
static void destroy();
|
||||
static void init();
|
||||
static void print(const char *fmt, ...);
|
||||
static void print(Level level, const char *fmt, ...);
|
||||
|
||||
@@ -71,9 +66,8 @@ public:
|
||||
private:
|
||||
static bool m_background;
|
||||
static bool m_colors;
|
||||
static uint32_t m_verbose;
|
||||
|
||||
static LogPrivate *d;
|
||||
static uint32_t m_verbose;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,14 +18,13 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "base/io/log/backends/ConsoleLog.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/config/Title.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
xmrig::ConsoleLog::ConsoleLog(const Title &title)
|
||||
@@ -75,7 +68,7 @@ xmrig::ConsoleLog::~ConsoleLog()
|
||||
}
|
||||
|
||||
|
||||
void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool colors)
|
||||
void xmrig::ConsoleLog::print(uint64_t, int, const char *line, size_t, size_t size, bool colors)
|
||||
{
|
||||
if (!m_tty || Log::isColors() != colors) {
|
||||
return;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -50,7 +44,7 @@ public:
|
||||
~ConsoleLog() override;
|
||||
|
||||
protected:
|
||||
void print(int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
|
||||
private:
|
||||
bool isSupported() const;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -37,7 +31,7 @@ xmrig::FileLog::FileLog(const char *fileName) :
|
||||
}
|
||||
|
||||
|
||||
void xmrig::FileLog::print(int, const char *line, size_t, size_t size, bool colors)
|
||||
void xmrig::FileLog::print(uint64_t, int, const char *line, size_t, size_t size, bool colors)
|
||||
{
|
||||
if (!m_writer.isOpen() || colors) {
|
||||
return;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -40,7 +34,7 @@ public:
|
||||
FileLog(const char *fileName);
|
||||
|
||||
protected:
|
||||
void print(int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
|
||||
private:
|
||||
FileLogWriter m_writer;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -43,7 +37,7 @@ xmrig::SysLog::~SysLog()
|
||||
}
|
||||
|
||||
|
||||
void xmrig::SysLog::print(int level, const char *line, size_t offset, size_t, bool colors)
|
||||
void xmrig::SysLog::print(uint64_t, int level, const char *line, size_t offset, size_t, bool colors)
|
||||
{
|
||||
if (colors) {
|
||||
return;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -36,11 +30,13 @@ namespace xmrig {
|
||||
class SysLog : public ILogBackend
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(SysLog)
|
||||
|
||||
SysLog();
|
||||
~SysLog() override;
|
||||
|
||||
protected:
|
||||
void print(int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user