mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
Guard alias added
This commit is contained in:
parent
13a9060b8b
commit
6e80fc8e24
2 changed files with 7 additions and 9 deletions
|
@ -24,11 +24,8 @@ void
|
||||||
MempoolStatus::start_mempool_status_thread()
|
MempoolStatus::start_mempool_status_thread()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (mempool_refresh_time < 1)
|
// to protect from deviation by zero below.
|
||||||
{
|
mempool_refresh_time = std::max<uint64_t>(1, mempool_refresh_time);
|
||||||
// to protect from diviation by zero below.
|
|
||||||
mempool_refresh_time = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_running)
|
if (!is_running)
|
||||||
{
|
{
|
||||||
|
@ -39,8 +36,7 @@ MempoolStatus::start_mempool_status_thread()
|
||||||
uint64_t loop_index {0};
|
uint64_t loop_index {0};
|
||||||
|
|
||||||
// so that network status is checked every minute
|
// so that network status is checked every minute
|
||||||
uint64_t loop_index_divider = 60 / mempool_refresh_time;
|
uint64_t loop_index_divider = std::max<uint64_t>(1, 60 / mempool_refresh_time);
|
||||||
loop_index_divider = loop_index_divider == 0 ? 1 : loop_index_divider;
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +188,7 @@ MempoolStatus::read_mempool()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lck (mempool_mutx);
|
Guard lck (mempool_mutx);
|
||||||
|
|
||||||
// clear current mempool txs vector
|
// clear current mempool txs vector
|
||||||
// repopulate it with each execution of read_mempool()
|
// repopulate it with each execution of read_mempool()
|
||||||
|
@ -265,7 +261,7 @@ MempoolStatus::read_network_info()
|
||||||
vector<MempoolStatus::mempool_tx>
|
vector<MempoolStatus::mempool_tx>
|
||||||
MempoolStatus::get_mempool_txs()
|
MempoolStatus::get_mempool_txs()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lck (mempool_mutx);
|
Guard lck (mempool_mutx);
|
||||||
return mempool_txs;
|
return mempool_txs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace xmreg
|
||||||
struct MempoolStatus
|
struct MempoolStatus
|
||||||
{
|
{
|
||||||
|
|
||||||
|
using Guard = std::lock_guard<std::mutex>;
|
||||||
|
|
||||||
struct mempool_tx
|
struct mempool_tx
|
||||||
{
|
{
|
||||||
crypto::hash tx_hash;
|
crypto::hash tx_hash;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue