Code cleanup.
This commit is contained in:
parent
2b87a10cf2
commit
7d1be2d234
19 changed files with 75 additions and 66 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue