Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit fa3ea1f

Browse files
committedMay 1, 2018
Merge remote-tracking branch 'origin/release/0.14'
# Conflicts: # .bumpversion.cfg # CMakeLists.txt # libpoolprotocols/stratum/EthStratumClient.cpp
2 parents 2a8fdb5 + 08e16bc commit fa3ea1f

File tree

4 files changed

+501
-129
lines changed

4 files changed

+501
-129
lines changed
 

‎ethminer/MinerAux.h

+7
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,13 @@ class MinerCLI
961961
mgr.addConnection(m_endpoints[i]);
962962
}
963963

964+
// If we are in simulation mode we add a fake connection
965+
if (m_mode == OperationMode::Simulation) {
966+
PoolConnection con(URI("http://-:0"));
967+
mgr.clearConnections();
968+
mgr.addConnection(con);
969+
}
970+
964971
#if API_CORE
965972
Api api(this->m_api_port, f);
966973
#endif

‎libpoolprotocols/PoolManager.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ void PoolManager::workLoop()
149149
std::string h = toHex(toCompactBigEndian(mp.rate(), 1));
150150
std::string res = h[0] != '0' ? h : h.substr(1);
151151

152-
p_client->submitHashrate("0x" + res);
152+
// Should be 32 bytes
153+
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate
154+
std::ostringstream ss;
155+
ss << std::setw(64) << std::setfill('0') << res;
156+
157+
p_client->submitHashrate("0x" + ss.str());
153158
m_hashrateReportingTimePassed = 0;
154159
}
155160
}

‎libpoolprotocols/stratum/EthStratumClient.cpp

+473-124
Large diffs are not rendered by default.

‎libpoolprotocols/stratum/EthStratumClient.h

+15-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ class EthStratumClient : public PoolClient
3131
void disconnect();
3232

3333
// Connected and Connection Statuses
34-
bool isConnected() { return m_connected.load(std::memory_order_relaxed); }
34+
bool isConnected()
35+
{
36+
return m_connected.load(std::memory_order_relaxed) &&
37+
!m_disconnecting.load(std::memory_order_relaxed);
38+
}
3539
bool isSubscribed() { return m_subscribed.load(std::memory_order_relaxed); }
3640
bool isAuthorized() { return m_authorized.load(std::memory_order_relaxed); }
3741
string ActiveEndPoint() { return " [" + toString(m_endpoint) + "]"; };
@@ -57,19 +61,25 @@ class EthStratumClient : public PoolClient
5761

5862
void recvSocketData();
5963
void onRecvSocketDataCompleted(const boost::system::error_code& ec, std::size_t bytes_transferred);
60-
void sendSocketData(string const & data);
64+
void sendSocketData(Json::Value const & jReq);
6165
void onSendSocketDataCompleted(const boost::system::error_code& ec);
6266

6367

64-
string m_worker; // eth-proxy only;
68+
string m_worker; // eth-proxy only; No ! It's for all !!!
6569

6670
std::atomic<bool> m_subscribed = { false };
6771
std::atomic<bool> m_authorized = { false };
6872
std::atomic<bool> m_connected = { false };
6973
std::atomic<bool> m_disconnecting = { false };
7074

71-
int m_worktimeout = 60;
75+
// Fixed 120 seconds to trigger a work_timeout
76+
int m_worktimeout = 120;
7277

78+
// Fixed 2 seconds timeout for a response to a submission of solution
79+
int m_responsetimeout = 2;
80+
81+
// Fixed 3 seconds timeout for a connection attempt
82+
int m_conntimeout = 3;
7383

7484
WorkPackage m_current;
7585

@@ -88,6 +98,7 @@ class EthStratumClient : public PoolClient
8898

8999
boost::asio::streambuf m_sendBuffer;
90100
boost::asio::streambuf m_recvBuffer;
101+
Json::FastWriter m_jWriter;
91102
int m_recvBufferSize = 1024;
92103

93104
boost::asio::deadline_timer m_conntimer;

0 commit comments

Comments
 (0)
This repository has been archived.