Adding mutex around work.
This commit is contained in:
parent
22890960bb
commit
848fdbc28a
2 changed files with 5 additions and 1 deletions
|
@ -261,6 +261,7 @@ void rai::network::receive_action (boost::system::error_code const & error, size
|
|||
receive ();
|
||||
if (!error)
|
||||
{
|
||||
std::lock_guard <std::mutex> lock (work_mutex);
|
||||
if (!work.validate (client.store.root (*incoming.block), incoming.work))
|
||||
{
|
||||
++publish_req_count;
|
||||
|
@ -289,6 +290,7 @@ void rai::network::receive_action (boost::system::error_code const & error, size
|
|||
receive ();
|
||||
if (!error)
|
||||
{
|
||||
std::lock_guard <std::mutex> lock (work_mutex);
|
||||
if (!work.validate (client.store.root (*incoming.block), incoming.work))
|
||||
{
|
||||
++confirm_req_count;
|
||||
|
@ -317,6 +319,7 @@ void rai::network::receive_action (boost::system::error_code const & error, size
|
|||
receive ();
|
||||
if (!error)
|
||||
{
|
||||
std::lock_guard <std::mutex> lock (work_mutex);
|
||||
if (!work.validate (client.store.root (*incoming.vote.block), incoming.work))
|
||||
{
|
||||
++confirm_ack_count;
|
||||
|
|
|
@ -473,12 +473,13 @@ namespace rai {
|
|||
rai::endpoint remote;
|
||||
std::array <uint8_t, 512> buffer;
|
||||
rai::work work;
|
||||
std::mutex work_mutex;
|
||||
boost::asio::ip::udp::socket socket;
|
||||
std::mutex socket_mutex;
|
||||
boost::asio::io_service & service;
|
||||
boost::asio::ip::udp::resolver resolver;
|
||||
rai::client & client;
|
||||
std::queue <std::tuple <uint8_t const *, size_t, rai::endpoint, std::function <void (boost::system::error_code const &, size_t)>>> sends;
|
||||
std::mutex mutex;
|
||||
uint64_t keepalive_count;
|
||||
uint64_t publish_req_count;
|
||||
uint64_t confirm_req_count;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue