From 63acddf812af0cc09e23652cb622c6b509038262 Mon Sep 17 00:00:00 2001 From: Genoil Date: Mon, 9 May 2016 13:40:44 +0200 Subject: [PATCH] remove linux build warnings --- ethminer/MinerAux.h | 6 ++++++ libdevcore/Common.cpp | 2 ++ libdevcore/TransientDirectory.cpp | 2 ++ libethash-cl/ethash_cl_miner.cpp | 3 +-- libstratum/EthStratumClient.cpp | 23 +++++++++++++++-------- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 34b1d1755..9f5bc3fe2 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -912,11 +912,17 @@ private: h256 hh(v[0].asString()); h256 newSeedHash(v[1].asString()); if (current.seedHash != newSeedHash) + { minelog << "Grabbing DAG for" << newSeedHash; + } if (!(dag = EthashAux::full(newSeedHash, true, [&](unsigned _pc){ cout << "\rCreating DAG. " << _pc << "% done..." << flush; return 0; }))) + { BOOST_THROW_EXCEPTION(DAGCreationFailure()); + } if (m_precompute) + { EthashAux::computeFull(sha3(newSeedHash), true); + } if (hh != current.headerHash) { current.headerHash = hh; diff --git a/libdevcore/Common.cpp b/libdevcore/Common.cpp index e38d0136d..ec457feee 100644 --- a/libdevcore/Common.cpp +++ b/libdevcore/Common.cpp @@ -54,7 +54,9 @@ TimerHelper::~TimerHelper() { auto e = std::chrono::high_resolution_clock::now() - m_t; if (!m_ms || e > chrono::milliseconds(m_ms)) + { clog(TimerChannel) << m_id << chrono::duration_cast(e).count() << "ms"; + } } } diff --git a/libdevcore/TransientDirectory.cpp b/libdevcore/TransientDirectory.cpp index cd91bd0e4..106848a9d 100644 --- a/libdevcore/TransientDirectory.cpp +++ b/libdevcore/TransientDirectory.cpp @@ -60,5 +60,7 @@ TransientDirectory::~TransientDirectory() ec.clear(); fs::remove_all(m_path, ec); if (!ec) + { cwarn << "Failed to delete directory '" << m_path << "': " << ec.message(); + } } diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index e048d1748..2ada903d1 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -379,7 +379,7 @@ bool ethash_cl_miner::init( sprintf(options, "-cl-nv-maxrregcount=%d", maxregs);// , computeCapability); } else { - sprintf(options, ""); + sprintf(options, "%s", ""); } // create context @@ -493,7 +493,6 @@ void ethash_cl_miner::search(uint8_t const* header, uint64_t target, search_hook uint64_t start_nonce = uniform_int_distribution()(engine); for (;; start_nonce += m_globalWorkSize) { - auto t = chrono::high_resolution_clock::now(); // supply output buffer to kernel m_searchKernel.setArg(0, m_searchBuffer[buf]); m_searchKernel.setArg(3, start_nonce); diff --git a/libstratum/EthStratumClient.cpp b/libstratum/EthStratumClient.cpp index af5ad8992..6b5139be1 100644 --- a/libstratum/EthStratumClient.cpp +++ b/libstratum/EthStratumClient.cpp @@ -144,11 +144,11 @@ void EthStratumClient::resolve_handler(const boost::system::error_code& ec, tcp: void EthStratumClient::connect_handler(const boost::system::error_code& ec, tcp::resolver::iterator i) { dev::setThreadName("stratum"); - + if (!ec) { m_connected = true; - cnote << "Connected to stratum server " << p_active->host << ":" << p_active->port; + cnote << "Connected to stratum server " << i->host_name() << ":" << p_active->port; if (!p_farm->isMining()) { cnote << "Starting farm"; @@ -207,7 +207,7 @@ void EthStratumClient::readResponse(const boost::system::error_code& ec, std::si m_pending = m_pending > 0 ? m_pending - 1 : 0; x_pending.unlock(); - if (!ec) + if (!ec && bytes_transferred) { std::istream is(&m_responseBuffer); std::string response; @@ -294,12 +294,13 @@ void EthStratumClient::processReponse(Json::Value& responseObject) string sHeaderHash = params.get((Json::Value::ArrayIndex)1, "").asString(); string sSeedHash = params.get((Json::Value::ArrayIndex)2, "").asString(); string sShareTarget = params.get((Json::Value::ArrayIndex)3, "").asString(); - bool cleanJobs = params.get((Json::Value::ArrayIndex)4, "").asBool(); - - if (sShareTarget.length() < 66) - sShareTarget = "0x" + string(66 - sShareTarget.length(), '0') + sShareTarget.substr(2); - + //bool cleanJobs = params.get((Json::Value::ArrayIndex)4, "").asBool(); + + // coinmine.pl fix int l = sShareTarget.length(); + if (l < 66) + sShareTarget = "0x" + string(66 - l, '0') + sShareTarget.substr(2); + if (sHeaderHash != "" && sSeedHash != "" && sShareTarget != "") { @@ -314,11 +315,17 @@ void EthStratumClient::processReponse(Json::Value& responseObject) if (seedHash != m_current.seedHash) + { cnote << "Grabbing DAG for" << seedHash; + } if (!(dag = EthashAux::full(seedHash, true, [&](unsigned _pc){ cout << "\rCreating DAG. " << _pc << "% done..." << flush; return 0; }))) + { BOOST_THROW_EXCEPTION(DAGCreationFailure()); + } if (m_precompute) + { EthashAux::computeFull(sha3(seedHash), true); + } if (headerHash != m_current.headerHash) { x_current.lock();