|
|
@ -140,95 +140,3 @@ void EthStratumClient::readResponse(const boost::system::error_code& ec, std::si |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void EthStratumClient::subscribe_handler(const boost::system::error_code& ec) { |
|
|
|
if (!ec) |
|
|
|
{ |
|
|
|
async_read_until(m_socket, m_responseBuffer, "\n", |
|
|
|
boost::bind(&EthStratumClient::read_subscribe_handler, this, |
|
|
|
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cerr << "Stratum subscription failed: " << ec.message(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void EthStratumClient::read_subscribe_handler(const boost::system::error_code& ec, std::size_t bytes_transferred) |
|
|
|
{ |
|
|
|
if (!ec) |
|
|
|
{ |
|
|
|
std::istream is(&m_responseBuffer); |
|
|
|
std::string response; |
|
|
|
getline(is, response); |
|
|
|
cnote << response; |
|
|
|
|
|
|
|
std::ostream os(&m_requestBuffer); |
|
|
|
os << "{\"id\": 2, \"method\": \"mining.authorize\", \"params\": [\"" << m_user << "\",\"" << m_pass << "\"]}\n"; |
|
|
|
|
|
|
|
//async_write(m_socket, m_requestBuffer,
|
|
|
|
// boost::bind(&EthStratumClient::authorize_handler, this,
|
|
|
|
// boost::asio::placeholders::error));
|
|
|
|
|
|
|
|
async_read_until(m_socket, m_responseBuffer, "\n", |
|
|
|
boost::bind(&EthStratumClient::read_work_handler, this, |
|
|
|
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cerr << "Stratum read subscription failed: " << ec.message(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void EthStratumClient::authorize_handler(const boost::system::error_code& ec) |
|
|
|
{ |
|
|
|
if (!ec) |
|
|
|
{ |
|
|
|
async_read_until(m_socket, m_responseBuffer, "\n", |
|
|
|
boost::bind(&EthStratumClient::read_authorize_handler, this, |
|
|
|
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cerr << "Stratum authorization failed: " << ec.message(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void EthStratumClient::read_authorize_handler(const boost::system::error_code& ec, std::size_t bytes_transferred) |
|
|
|
{ |
|
|
|
if (!ec) |
|
|
|
{ |
|
|
|
std::istream is(&m_responseBuffer); |
|
|
|
std::string response; |
|
|
|
getline(is, response); |
|
|
|
cnote << response; |
|
|
|
|
|
|
|
async_read_until(m_socket, m_responseBuffer, "\n", |
|
|
|
boost::bind(&EthStratumClient::read_work_handler, this, |
|
|
|
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cerr << "Stratum read authorization failed: " << ec.message(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void EthStratumClient::read_work_handler(const boost::system::error_code& ec, std::size_t bytes_transferred) |
|
|
|
{ |
|
|
|
if (!ec) |
|
|
|
{ |
|
|
|
std::istream is(&m_responseBuffer); |
|
|
|
std::string response; |
|
|
|
getline(is, response); |
|
|
|
cnote << response; |
|
|
|
|
|
|
|
async_read_until(m_socket, m_responseBuffer, "\n", |
|
|
|
boost::bind(&EthStratumClient::read_work_handler, this, |
|
|
|
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cerr << "Stratum read work failed: " << ec.message(); |
|
|
|
} |
|
|
|
} |