Code cleanup.

This commit is contained in:
XMRig 2019-11-29 10:17:05 +07:00
parent 2b87a10cf2
commit 7d1be2d234
No known key found for this signature in database
GPG key ID: 446A53638BE94409
19 changed files with 75 additions and 66 deletions

View file

@ -24,27 +24,30 @@
*/
#include "base/net/http/HttpContext.h"
#include "3rdparty/http-parser/http_parser.h"
#include "base/kernel/interfaces/IHttpListener.h"
#include "base/tools/Chrono.h"
#include <algorithm>
#include <uv.h>
#include "3rdparty/http-parser/http_parser.h"
#include "base/kernel/interfaces/IHttpListener.h"
#include "base/net/http/HttpContext.h"
namespace xmrig {
static http_parser_settings http_settings;
static std::map<uint64_t, HttpContext *> storage;
static uint64_t SEQUENCE = 0;
} // namespace xmrig
xmrig::HttpContext::HttpContext(int parser_type, IHttpListener *listener) :
HttpData(SEQUENCE++),
m_wasHeaderValue(false),
m_timestamp(Chrono::steadyMSecs()),
m_listener(listener)
{
storage[id()] = this;
@ -96,6 +99,12 @@ std::string xmrig::HttpContext::ip() const
}
uint64_t xmrig::HttpContext::elapsed() const
{
return Chrono::steadyMSecs() - m_timestamp;
}
void xmrig::HttpContext::close(int status)
{
if (status < 0 && m_listener) {