Add missing call to dosGuard_.add

This commit is contained in:
CJ Cobb
2021-09-14 14:26:54 -04:00
parent 9ef54da0ef
commit 5f23a5803b

View File

@@ -155,18 +155,23 @@ public:
}
void
send(std::string const& msg)
send(std::string&& msg)
{
size_t left = 0;
{
std::lock_guard<std::mutex> lck(mtx_);
messages_.push(msg);
messages_.push(std::move(msg));
left = messages_.size();
}
// if the queue was previously empty, start the send chain
if (left == 1)
sendNext();
}
void
send(std::string const& msg)
{
send({msg});
}
void
run(http::request<http::string_body> req)
@@ -296,7 +301,9 @@ public:
BOOST_LOG_TRIVIAL(trace)
<< __func__ << " : " << boost::json::serialize(response);
send(boost::json::serialize(response));
std::string responseStr = boost::json::serialize(response);
dosGuard_.add(ip, responseStr.size());
send(std::move(responseStr));
do_read();
}
};