Added a command line parameter to disable Stratum HTTP

This commit is contained in:
SChernykh
2024-12-17 11:39:49 +01:00
parent 2581b4c2da
commit a4459d6207
6 changed files with 16 additions and 1 deletions
+6 -1
View File
@@ -602,6 +602,11 @@ void StratumServer::reset_share_counters()
m_totalFailedShares = 0;
}
bool StratumServer::http_enabled() const
{
return m_pool->params().m_enableStratumHTTP;
}
const char* StratumServer::get_log_category() const
{
return log_category_prefix;
@@ -1204,7 +1209,7 @@ bool StratumServer::StratumClient::on_read(const char* data, uint32_t size)
for (char *c = line_start + m_stratumReadBufBytes - size; c < e; ++c) {
if (*c == '\n') {
// Check if the line starts with "GET " or "HEAD" (an HTTP request)
if (c - line_start >= 4) {
if (static_cast<StratumServer*>(m_owner)->http_enabled() && (c - line_start >= 4)) {
const uint32_t line_start_data = read_unaligned(reinterpret_cast<uint32_t*>(line_start));
const bool is_http_get = (line_start_data == 0x20544547U);