HTTP subsystem refactoring, fixed possible crashes shortly after destroying daemon or self-select client.
This commit is contained in:
parent
23c51c9a11
commit
1ee27a564b
16 changed files with 129 additions and 58 deletions
|
@ -5,8 +5,8 @@
|
|||
* 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-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 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
|
||||
|
@ -54,6 +54,8 @@ xmrig::Httpd::Httpd(Base *base) :
|
|||
m_server(nullptr),
|
||||
m_port(0)
|
||||
{
|
||||
m_httpListener = std::make_shared<HttpListener>(this);
|
||||
|
||||
base->addListener(this);
|
||||
}
|
||||
|
||||
|
@ -69,7 +71,7 @@ bool xmrig::Httpd::start()
|
|||
return true;
|
||||
}
|
||||
|
||||
m_http = new HttpServer(this);
|
||||
m_http = new HttpServer(m_httpListener);
|
||||
m_server = new TcpServer(config.host(), config.port(), m_http);
|
||||
|
||||
const int rc = m_server->bind();
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 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-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 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,14 +26,15 @@
|
|||
#define XMRIG_HTTPD_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/kernel/interfaces/IHttpListener.h"
|
||||
#include "base/net/http/HttpListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
@ -62,6 +63,7 @@ private:
|
|||
|
||||
Base *m_base;
|
||||
HttpServer *m_http;
|
||||
std::shared_ptr<IHttpListener> m_httpListener;
|
||||
TcpServer *m_server;
|
||||
uint16_t m_port;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue