mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Cleanup code using move semantics
This commit is contained in:
@@ -424,40 +424,43 @@ ShardArchiveHandler::complete(path dstPath)
|
||||
}
|
||||
}
|
||||
|
||||
auto wrapper = jobCounter_.wrap([=, dstPath = std::move(dstPath)](Job&) {
|
||||
if (isStopping())
|
||||
return;
|
||||
// Make lambdas mutable captured vars can be moved from
|
||||
auto wrapper =
|
||||
jobCounter_.wrap([=, dstPath = std::move(dstPath)](Job&) mutable {
|
||||
if (isStopping())
|
||||
return;
|
||||
|
||||
// If not synced then defer and retry
|
||||
auto const mode{app_.getOPs().getOperatingMode()};
|
||||
if (mode != OperatingMode::FULL)
|
||||
{
|
||||
std::lock_guard lock(m_);
|
||||
timer_.expires_from_now(static_cast<std::chrono::seconds>(
|
||||
(static_cast<std::size_t>(OperatingMode::FULL) -
|
||||
static_cast<std::size_t>(mode)) *
|
||||
10));
|
||||
// If not synced then defer and retry
|
||||
auto const mode{app_.getOPs().getOperatingMode()};
|
||||
if (mode != OperatingMode::FULL)
|
||||
{
|
||||
std::lock_guard lock(m_);
|
||||
timer_.expires_from_now(static_cast<std::chrono::seconds>(
|
||||
(static_cast<std::size_t>(OperatingMode::FULL) -
|
||||
static_cast<std::size_t>(mode)) *
|
||||
10));
|
||||
|
||||
auto wrapper =
|
||||
timerCounter_.wrap([=, dstPath = std::move(dstPath)](
|
||||
boost::system::error_code const& ec) {
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
complete(std::move(dstPath));
|
||||
});
|
||||
auto wrapper = timerCounter_.wrap(
|
||||
[=, dstPath = std::move(dstPath)](
|
||||
boost::system::error_code const& ec) mutable {
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
complete(std::move(dstPath));
|
||||
});
|
||||
|
||||
if (!wrapper)
|
||||
onClosureFailed(
|
||||
"failed to wrap closure for operating mode timer", lock);
|
||||
if (!wrapper)
|
||||
onClosureFailed(
|
||||
"failed to wrap closure for operating mode timer",
|
||||
lock);
|
||||
else
|
||||
timer_.async_wait(*wrapper);
|
||||
}
|
||||
else
|
||||
timer_.async_wait(*wrapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
process(dstPath);
|
||||
std::lock_guard lock(m_);
|
||||
removeAndProceed(lock);
|
||||
}
|
||||
});
|
||||
{
|
||||
process(dstPath);
|
||||
std::lock_guard lock(m_);
|
||||
removeAndProceed(lock);
|
||||
}
|
||||
});
|
||||
|
||||
if (!wrapper)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user