mirror of https://github.com/GOSTSec/poolserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
989 B
35 lines
989 B
#include "Server.h" |
|
|
|
namespace Stratum |
|
{ |
|
void Server::Start(tcp::endpoint endpoint) |
|
{ |
|
_acceptor.open(endpoint.protocol()); |
|
_acceptor.set_option(tcp::acceptor::reuse_address(true)); |
|
_acceptor.bind(endpoint); |
|
_acceptor.listen(); |
|
|
|
_StartAccept(); |
|
|
|
sLog.Debug(LOG_STRATUM, "Stratum server started"); |
|
} |
|
|
|
void Server::SendToAll(JSON msg) |
|
{ |
|
std::set<ClientPtr>::iterator it; |
|
for (it = _clients.begin(); it != _clients.end(); ++it) |
|
_io_service.post(boost::bind(&Client::SendMessage, (*it), msg)); |
|
} |
|
|
|
void Server::SendBlockTmpl(bool resetWork) |
|
{ |
|
std::set<ClientPtr>::iterator it; |
|
for (it = _clients.begin(); it != _clients.end(); ++it) |
|
_io_service.post(boost::bind(&Client::SendJob, (*it), resetWork)); |
|
} |
|
|
|
bool Server::SubmitBlock(Bitcoin::Block block) |
|
{ |
|
return NetworkMgr::Instance()->SubmitBlock(block); |
|
} |
|
}
|
|
|