Fixed build with APP_DEBUG.

This commit is contained in:
XMRig 2018-04-11 08:29:02 +07:00
parent 1ebaf677e0
commit a73ad9b089
6 changed files with 12 additions and 12 deletions

View file

@ -123,7 +123,7 @@ static void print_pools(xmrig::Config *config)
# ifdef APP_DEBUG
for (size_t i = 0; i < pools.size(); ++i) {
Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i]->host(), pools[i]->port(), pools[i]->user(), pools[i]->password(), pools[i]->keepAlive(), pools[i]->isNicehash());
Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i].host(), pools[i].port(), pools[i].user(), pools[i].password(), pools[i].keepAlive(), pools[i].isNicehash());
}
# endif
}

View file

@ -107,7 +107,7 @@ void Client::connect()
*/
void Client::connect(const Pool &url)
{
setUrl(url);
setPool(url);
connect();
}
@ -131,7 +131,7 @@ void Client::deleteLater()
}
void Client::setUrl(const Pool &pool)
void Client::setPool(const Pool &pool)
{
if (!pool.isValid()) {
return;
@ -360,9 +360,9 @@ int Client::resolve(const char *host)
int64_t Client::send(size_t size)
{
LOG_DEBUG("[%s:%u] send (%d bytes): \"%s\"", m_url.host(), m_url.port(), size, m_sendBuf);
LOG_DEBUG("[%s] send (%d bytes): \"%s\"", m_pool.url(), size, m_sendBuf);
if (state() != ConnectedState || !uv_is_writable(m_stream)) {
LOG_DEBUG_ERR("[%s:%u] send failed, invalid state: %d", m_url.host(), m_url.port(), m_state);
LOG_DEBUG_ERR("[%s] send failed, invalid state: %d", m_pool.url(), m_state);
return -1;
}
@ -475,7 +475,7 @@ void Client::parse(char *line, size_t len)
line[len - 1] = '\0';
LOG_DEBUG("[%s:%u] received (%d bytes): \"%s\"", m_url.host(), m_url.port(), len, line);
LOG_DEBUG("[%s] received (%d bytes): \"%s\"", m_pool.url(), len, line);
if (len < 32 || line[0] != '{') {
if (!m_quiet) {
@ -634,7 +634,7 @@ void Client::reconnect()
void Client::setState(SocketState state)
{
LOG_DEBUG("[%s:%u] state: %d", m_url.host(), m_url.port(), state);
LOG_DEBUG("[%s] state: %d", m_pool.url(), state);
if (m_state == state) {
return;

View file

@ -63,7 +63,7 @@ public:
void connect();
void connect(const Pool &pool);
void deleteLater();
void setUrl(const Pool &pool);
void setPool(const Pool &pool);
void tick(uint64_t now);
inline bool isReady() const { return m_state == ConnectedState && m_failures == 0; }

View file

@ -76,7 +76,6 @@ Pool::Pool(const char *url) :
m_keepAlive(0),
m_port(kDefaultPort),
m_algo(xmrig::CRYPTONIGHT),
m_url(url),
m_variant(xmrig::VARIANT_AUTO)
{
parse(url);
@ -150,6 +149,7 @@ bool Pool::parse(const char *url)
return false;
}
m_url = url;
if (base[0] == '[') {
return parseIPv6(base);
}
@ -157,7 +157,7 @@ bool Pool::parse(const char *url)
const char *port = strchr(base, ':');
if (!port) {
m_host = base;
return false;
return true;
}
const size_t size = port++ - base + 1;

View file

@ -156,7 +156,7 @@ void FailoverStrategy::onResultAccepted(Client *client, const SubmitResult &resu
void FailoverStrategy::add(const Pool &pool)
{
Client *client = new Client((int) m_pools.size(), Platform::userAgent(), this);
client->setUrl(pool);
client->setPool(pool);
client->setRetryPause(m_retryPause * 1000);
client->setQuiet(m_quiet);

View file

@ -33,7 +33,7 @@ SinglePoolStrategy::SinglePoolStrategy(const Pool &pool, int retryPause, IStrate
m_listener(listener)
{
m_client = new Client(0, Platform::userAgent(), this);
m_client->setUrl(pool);
m_client->setPool(pool);
m_client->setRetryPause(retryPause * 1000);
m_client->setQuiet(quiet);
}