void BulkRound::ShuffleFinished() { if(!_shuffle_round->Successful()) { _bad_members = _shuffle_round->GetBadMembers(); _state = Finished; Stop("ShuffleRound failed"); return; } if(0 == _shuffle_sink.Count()) { _state = Finished; SetSuccessful(true); Stop("Round successfully finished -- no bulk messages"); return; } PrepareBlameShuffle(); GenerateXorMessages(); if(_app_broadcast && !IsLeader()) { _state = ReceivingLeaderData; } else { _state = DataSharing; } for(int idx = 0; idx < _offline_log.Count(); idx++) { QPair<QByteArray, Id> entry = _offline_log.At(idx); ProcessData(entry.second, entry.first); } _offline_log.Clear(); }
// This is an internal helper function which assumes no NULL args are passed. // It sets the given attribute values for a single entry at the given index. static int SetEntryAttributes(struct drive *drive, uint32_t index, CgptAddParams *params) { if (params->set_raw) { SetRaw(drive, PRIMARY, index, params->raw_value); } else { if (params->set_successful) SetSuccessful(drive, PRIMARY, index, params->successful); if (params->set_tries) SetTries(drive, PRIMARY, index, params->tries); if (params->set_priority) SetPriority(drive, PRIMARY, index, params->priority); } // New partitions must specify type, begin, and size. if (IsUnused(drive, PRIMARY, index)) { if (!params->set_begin || !params->set_size || !params->set_type) { Error("-t, -b, and -s options are required for new partitions\n"); return -1; } if (GuidIsZero(¶ms->type_guid)) { Error("New partitions must have a type other than \"unused\"\n"); return -1; } } return 0; }
void EmptyRound::OnStart() { qDebug() << "Starting empty round."; Round::OnStart(); QPair<QByteArray, bool> data = GetData(1024); GetNetwork()->Broadcast(data.first); SetSuccessful(true); Stop("Round successfully finished."); }
void FindNotification::handleNext (const QString& text, FindFlags findFlags) { const auto flags = ToPageFlags (findFlags); if (PreviousFindText_ != text) { WebView_->findText ({}, flags); PreviousFindText_ = text; } WebView_->findText (text, flags, [this] (bool found) { SetSuccessful (found); }); }
void BulkRound::BlameShuffleFinished() { for(int idx = 0; idx < _shuffle_sink.Count(); idx++) { QPair<QSharedPointer<ISender>, QByteArray> pair(_shuffle_sink.At(idx)); QDataStream stream(pair.second); QVector<BlameEntry> blame_vector; stream >> blame_vector; if(blame_vector.count()) { ProcessBlame(blame_vector); } } _state = Finished; SetSuccessful(false); Stop("Round finished with blame"); }
void FindNotificationWk::handleNext (const QString& text, FindNotification::FindFlags findFlags) { const auto flags = ToPageFlags (findFlags); if (PreviousFindText_ != text) { const auto nflags = flags | QWebPage::HighlightAllOccurrences; WebView_->page ()->findText ({}, nflags); WebView_->page ()->findText (text, nflags); PreviousFindText_ = text; } const auto found = WebView_->page ()->findText (text, flags); SetSuccessful (found); }
void BulkRound::Finish() { if(_bad_message_hash.isEmpty()) { if(_app_broadcast && IsLeader()) { QByteArray msg; QDataStream stream(&msg, QIODevice::WriteOnly); stream << AggregatedBulkData << GetRoundId() << _cleartexts; VerifiableBroadcast(msg); } _state = Finished; SetSuccessful(true); Stop("Round successfully finished"); } else { if(_app_broadcast && IsLeader()) { QByteArray msg; QDataStream stream(&msg, QIODevice::WriteOnly); stream << LoggedBulkData << GetRoundId() << _log.Serialize(); VerifiableBroadcast(msg); } BeginBlame(); } }