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

@ -49,7 +49,7 @@ xmrig::HttpServer::~HttpServer()
void xmrig::HttpServer::onConnection(uv_stream_t *stream, uint16_t)
{
HttpContext *ctx = new HttpContext(HTTP_REQUEST, m_listener);
auto ctx = new HttpContext(HTTP_REQUEST, m_listener);
uv_accept(stream, ctx->stream());
uv_read_start(ctx->stream(),
@ -65,11 +65,11 @@ void xmrig::HttpServer::onConnection(uv_stream_t *stream, uint16_t)
},
[](uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf)
{
HttpContext *ctx = static_cast<HttpContext*>(tcp->data);
auto ctx = static_cast<HttpContext*>(tcp->data);
if (nread >= 0) {
const size_t size = static_cast<size_t>(nread);
const size_t parsed = ctx->parse(buf->base, size);
const auto size = static_cast<size_t>(nread);
const auto parsed = ctx->parse(buf->base, size);
if (parsed < size) {
ctx->close();