Exemplo n.º 1
0
void
NtpWork::onNtpClientSuccess(long int time)
{
    auto localNow = std::chrono::duration_cast<std::chrono::seconds>(
        std::chrono::system_clock::now().time_since_epoch());
    auto ntpNow = std::chrono::seconds(time);
    auto diff = localNow - ntpNow;
    diff = diff > std::chrono::seconds::zero() ? diff : -diff;

    mIsSynchronized = diff <= mTolerance;
    scheduleSuccess();
}
Exemplo n.º 2
0
void
ApplyLedgerChainWork::onRun()
{
    try
    {
        if (!applyHistoryOfSingleLedger())
        {
            mCurrSeq += mApp.getHistoryManager().getCheckpointFrequency();
            openCurrentInputFiles();
        }
        scheduleSuccess();
    }
    catch (std::runtime_error& e)
    {
        CLOG(ERROR, "History") << "Replay failed: " << e.what();
        scheduleFailure();
    }
}
Exemplo n.º 3
0
void
ApplyBucketsWork::onRun()
{
    // The structure of these if statements is motivated by the following:
    // 1. mCurrApplicator should never be advanced if mSnapApplicator is
    //    not false. Otherwise it is possible for curr to modify the
    //    database when the invariants for snap are checked.
    // 2. There is no reason to advance mSnapApplicator or mCurrApplicator
    //    if there is nothing to be applied.
    if (mSnapApplicator)
    {
        advance(*mSnapApplicator);
    }
    else if (mCurrApplicator)
    {
        advance(*mCurrApplicator);
    }
    scheduleSuccess();
}
Exemplo n.º 4
0
void
Work::onRun()
{
    scheduleSuccess();
}