Added "GET /2/dmi" API endpoint.

This commit is contained in:
XMRig 2021-01-20 22:54:02 +07:00
parent 9a02007900
commit 8471f7fad3
No known key found for this signature in database
GPG key ID: 446A53638BE94409
17 changed files with 263 additions and 74 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;
}
@ -64,7 +67,7 @@ void xmrig::Controller::start()
{
Base::start();
m_miner = new Miner(this);
m_miner = std::make_shared<Miner>(this);
network()->connect();
}
@ -74,29 +77,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();
}