Merge xmrig v6.8.0 into master

This commit is contained in:
MoneroOcean 2021-01-26 16:30:10 +00:00
commit 0c1fda1ada
70 changed files with 2872 additions and 1050 deletions

View file

@ -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 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 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,12 @@
#include "net/Network.h"
#ifdef XMRIG_FEATURE_API
# include "base/api/Api.h"
# include "hw/api/HwApi.h"
#endif
#include <cassert>
@ -42,8 +42,6 @@ xmrig::Controller::Controller(Process *process) :
xmrig::Controller::~Controller()
{
delete m_network;
VirtualMemory::destroy();
}
@ -54,7 +52,12 @@ int xmrig::Controller::init()
VirtualMemory::init(config()->cpu().memPoolSize(), config()->cpu().isHugePages());
m_network = new Network(this);
m_network = std::make_shared<Network>(this);
# ifdef XMRIG_FEATURE_API
m_hwApi = std::make_shared<HwApi>();
api()->addListener(m_hwApi.get());
# endif
return 0;
}
@ -62,7 +65,7 @@ int xmrig::Controller::init()
#ifdef XMRIG_FEATURE_MO_BENCHMARK
void xmrig::Controller::pre_start()
{
m_miner = new Miner(this);
m_miner = std::make_shared<Miner>(this);
}
#endif
@ -70,9 +73,9 @@ void xmrig::Controller::pre_start()
void xmrig::Controller::start()
{
Base::start();
#ifndef XMRIG_FEATURE_BENCHMARK
m_miner = new Miner(this);
#endif
if (m_miner == nullptr) m_miner = std::make_shared<Miner>(this);
network()->connect();
}
@ -81,29 +84,26 @@ void xmrig::Controller::stop()
{
Base::stop();
delete m_network;
m_network = nullptr;
m_network.reset();
m_miner->stop();
delete m_miner;
m_miner = nullptr;
m_miner.reset();
}
xmrig::Miner *xmrig::Controller::miner() const
{
assert(m_miner != nullptr);
assert(m_miner);
return m_miner;
return m_miner.get();
}
xmrig::Network *xmrig::Controller::network() const
{
assert(m_network != nullptr);
assert(m_network);
return m_network;
return m_network.get();
}