New DNS implementation.
This commit is contained in:
parent
5b189696d7
commit
3e41bdc552
14 changed files with 357 additions and 121 deletions
|
@ -48,10 +48,11 @@
|
|||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/interfaces/IClientListener.h"
|
||||
#include "base/net/dns/Dns.h"
|
||||
#include "base/net/dns/DnsRecords.h"
|
||||
#include "base/net/stratum/Socks5.h"
|
||||
#include "base/net/tools/NetBuffer.h"
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "net/JobResult.h"
|
||||
|
||||
|
||||
|
@ -86,13 +87,11 @@ xmrig::Client::Client(int id, const char *agent, IClientListener *listener) :
|
|||
{
|
||||
m_reader.setListener(this);
|
||||
m_key = m_storage.add(this);
|
||||
m_dns = new Dns(this);
|
||||
}
|
||||
|
||||
|
||||
xmrig::Client::~Client()
|
||||
{
|
||||
delete m_dns;
|
||||
delete m_socket;
|
||||
}
|
||||
|
||||
|
@ -295,8 +294,10 @@ void xmrig::Client::tick(uint64_t now)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Client::onResolved(const DnsRecords &records, int status)
|
||||
void xmrig::Client::onResolved(const DnsRecords &records, int status, const char *error)
|
||||
{
|
||||
m_dns.reset();
|
||||
|
||||
assert(m_listener != nullptr);
|
||||
if (!m_listener) {
|
||||
return reconnect();
|
||||
|
@ -304,7 +305,7 @@ void xmrig::Client::onResolved(const DnsRecords &records, int status)
|
|||
|
||||
if (status < 0 && records.isEmpty()) {
|
||||
if (!isQuiet()) {
|
||||
LOG_ERR("%s " RED("DNS error: ") RED_BOLD("\"%s\""), tag(), uv_strerror(status));
|
||||
LOG_ERR("%s " RED("DNS error: ") RED_BOLD("\"%s\""), tag(), error);
|
||||
}
|
||||
|
||||
return reconnect();
|
||||
|
@ -524,13 +525,7 @@ int xmrig::Client::resolve(const String &host)
|
|||
m_failures = 0;
|
||||
}
|
||||
|
||||
if (!m_dns->resolve(host)) {
|
||||
if (!isQuiet()) {
|
||||
LOG_ERR("%s " RED("getaddrinfo error: ") RED_BOLD("\"%s\""), tag(), uv_strerror(m_dns->status()));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
m_dns = Dns::resolve(host, this);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue