Added DnsRecords class.
This commit is contained in:
parent
c6bcea3811
commit
5b189696d7
12 changed files with 187 additions and 98 deletions
|
@ -295,14 +295,14 @@ void xmrig::Client::tick(uint64_t now)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Client::onResolved(const Dns &dns, int status)
|
||||
void xmrig::Client::onResolved(const DnsRecords &records, int status)
|
||||
{
|
||||
assert(m_listener != nullptr);
|
||||
if (!m_listener) {
|
||||
return reconnect();
|
||||
}
|
||||
|
||||
if (status < 0 && dns.isEmpty()) {
|
||||
if (status < 0 && records.isEmpty()) {
|
||||
if (!isQuiet()) {
|
||||
LOG_ERR("%s " RED("DNS error: ") RED_BOLD("\"%s\""), tag(), uv_strerror(status));
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void xmrig::Client::onResolved(const Dns &dns, int status)
|
|||
return reconnect();
|
||||
}
|
||||
|
||||
const auto &record = dns.get();
|
||||
const auto &record = records.get();
|
||||
m_ip = record.ip();
|
||||
|
||||
connect(record.addr(m_socks5 ? m_pool.proxy().port() : m_pool.port()));
|
||||
|
|
|
@ -50,6 +50,7 @@ using BIO = struct bio_st;
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
class Dns;
|
||||
class IClientListener;
|
||||
class JobResult;
|
||||
|
||||
|
@ -79,7 +80,7 @@ protected:
|
|||
void deleteLater() override;
|
||||
void tick(uint64_t now) override;
|
||||
|
||||
void onResolved(const Dns &dns, int status) override;
|
||||
void onResolved(const DnsRecords &records, int status) override;
|
||||
|
||||
inline bool hasExtension(Extension extension) const noexcept override { return m_extensions.test(extension); }
|
||||
inline const char *mode() const override { return "pool"; }
|
||||
|
|
|
@ -185,16 +185,16 @@ void xmrig::BenchClient::onHttpData(const HttpData &data)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::onResolved(const Dns &dns, int status)
|
||||
void xmrig::BenchClient::onResolved(const DnsRecords &records, int status)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
assert(!m_httpListener);
|
||||
|
||||
if (status < 0) {
|
||||
return setError(dns.error(), "DNS error");
|
||||
return setError(uv_strerror(status), "DNS error");
|
||||
}
|
||||
|
||||
m_ip = dns.get().ip();
|
||||
m_ip = records.get().ip();
|
||||
m_httpListener = std::make_shared<HttpListener>(this, tag());
|
||||
|
||||
if (m_mode == ONLINE_BENCH) {
|
||||
|
@ -310,7 +310,7 @@ void xmrig::BenchClient::resolve()
|
|||
m_dns = std::make_shared<Dns>(this);
|
||||
|
||||
if (!m_dns->resolve(BenchConfig::kApiHost)) {
|
||||
setError(m_dns->error(), "getaddrinfo error");
|
||||
setError(uv_strerror(m_dns->status()), "getaddrinfo error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
void onBenchDone(uint64_t result, uint64_t diff, uint64_t ts) override;
|
||||
void onBenchReady(uint64_t ts, uint32_t threads, const IBackend *backend) override;
|
||||
void onHttpData(const HttpData &data) override;
|
||||
void onResolved(const Dns &dns, int status) override;
|
||||
void onResolved(const DnsRecords &records, int status) override;
|
||||
|
||||
private:
|
||||
enum Mode : uint32_t {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue