Parameterizing transaction to find next request, nested transactions have possible deadlocks.
This commit is contained in:
parent
547e2d66b8
commit
497baee3b1
2 changed files with 13 additions and 15 deletions
|
@ -270,7 +270,8 @@ current (0),
|
|||
count (0),
|
||||
next_report (std::chrono::system_clock::now () + std::chrono::seconds (15))
|
||||
{
|
||||
next ();
|
||||
rai::transaction transaction (connection->node->store.environment, nullptr, false);
|
||||
next (transaction);
|
||||
}
|
||||
|
||||
rai::frontier_req_client::~frontier_req_client ()
|
||||
|
@ -346,27 +347,25 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons
|
|||
{
|
||||
while (!current.is_zero () && current < account)
|
||||
{
|
||||
// We know about an account they don't.
|
||||
rai::transaction transaction (connection->node->store.environment, nullptr, true);
|
||||
if (connection->node->wallets.exists (transaction, current))
|
||||
{
|
||||
// We know about an account they don't.
|
||||
rai::transaction transaction (connection->node->store.environment, nullptr, true);
|
||||
if (connection->node->wallets.exists (transaction, current))
|
||||
{
|
||||
unsynced (transaction, info.head, 0);
|
||||
}
|
||||
unsynced (transaction, info.head, 0);
|
||||
}
|
||||
next ();
|
||||
next (transaction);
|
||||
}
|
||||
if (!current.is_zero ())
|
||||
{
|
||||
if (account == current)
|
||||
{
|
||||
rai::transaction transaction (connection->node->store.environment, nullptr, true);
|
||||
if (latest == info.head)
|
||||
{
|
||||
// In sync
|
||||
}
|
||||
else
|
||||
{
|
||||
rai::transaction transaction (connection->node->store.environment, nullptr, true);
|
||||
if (connection->node->store.block_exists (transaction, latest))
|
||||
{
|
||||
// We know about a block they don't.
|
||||
|
@ -390,7 +389,7 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons
|
|||
}
|
||||
}
|
||||
}
|
||||
next ();
|
||||
next (transaction);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -415,7 +414,7 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons
|
|||
{
|
||||
unsynced (transaction, info.head, 0);
|
||||
}
|
||||
next ();
|
||||
next (transaction);
|
||||
}
|
||||
}
|
||||
connection->completed_frontier_request ();
|
||||
|
@ -430,10 +429,9 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons
|
|||
}
|
||||
}
|
||||
|
||||
void rai::frontier_req_client::next ()
|
||||
void rai::frontier_req_client::next (MDB_txn * transaction_a)
|
||||
{
|
||||
rai::transaction transaction (connection->node->store.environment, nullptr, false);
|
||||
auto iterator (connection->node->store.latest_begin (transaction, rai::uint256_union (current.number () + 1)));
|
||||
auto iterator (connection->node->store.latest_begin (transaction_a, rai::uint256_union (current.number () + 1)));
|
||||
if (iterator != connection->node->store.latest_end ())
|
||||
{
|
||||
current = rai::account (iterator->first);
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
void received_frontier (boost::system::error_code const &, size_t);
|
||||
void request_account (rai::account const &, rai::block_hash const &);
|
||||
void unsynced (MDB_txn *, rai::account const &, rai::block_hash const &);
|
||||
void next ();
|
||||
void next (MDB_txn *);
|
||||
std::shared_ptr <rai::bootstrap_client> connection;
|
||||
rai::account current;
|
||||
rai::account_info info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue