From a73ad9b08924ff4b1ccfe78ae949a6e27a5cb2e1 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 11 Apr 2018 08:29:02 +0700 Subject: [PATCH] Fixed build with APP_DEBUG. --- src/Summary.cpp | 2 +- src/net/Client.cpp | 12 ++++++------ src/net/Client.h | 2 +- src/net/Pool.cpp | 4 ++-- src/net/strategies/FailoverStrategy.cpp | 2 +- src/net/strategies/SinglePoolStrategy.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Summary.cpp b/src/Summary.cpp index 6de1cd3a8..5acda5c2f 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -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 } diff --git a/src/net/Client.cpp b/src/net/Client.cpp index 5574f37f5..c4387a7c7 100644 --- a/src/net/Client.cpp +++ b/src/net/Client.cpp @@ -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; diff --git a/src/net/Client.h b/src/net/Client.h index 910c8379a..0692d38b4 100644 --- a/src/net/Client.h +++ b/src/net/Client.h @@ -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; } diff --git a/src/net/Pool.cpp b/src/net/Pool.cpp index f68165679..b3766b08c 100644 --- a/src/net/Pool.cpp +++ b/src/net/Pool.cpp @@ -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; diff --git a/src/net/strategies/FailoverStrategy.cpp b/src/net/strategies/FailoverStrategy.cpp index 7a581407c..a4e252775 100644 --- a/src/net/strategies/FailoverStrategy.cpp +++ b/src/net/strategies/FailoverStrategy.cpp @@ -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); diff --git a/src/net/strategies/SinglePoolStrategy.cpp b/src/net/strategies/SinglePoolStrategy.cpp index 42a60b30f..8c113d933 100644 --- a/src/net/strategies/SinglePoolStrategy.cpp +++ b/src/net/strategies/SinglePoolStrategy.cpp @@ -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); }