More fixes and refactoring

This commit is contained in:
SChernykh
2026-04-24 17:51:08 +02:00
parent e1acf7b786
commit fa53bdea55
8 changed files with 51 additions and 22 deletions
+7
View File
@@ -41,6 +41,13 @@ MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::st
const size_t k = host.find_last_of(':');
if (k != std::string::npos) {
m_host = host.substr(0, k);
// Handle IPv6 addresses
if ((m_host.length() > 2) && (m_host.find_first_of(':') != std::string::npos) && (m_host.front() == '[') && (m_host.back() == ']')) {
m_host.erase(m_host.begin());
m_host.pop_back();
}
m_port = static_cast<int32_t>(std::stol(host.substr(k + 1), nullptr, 10));
}