Пример #1
0
  BaseBulkRound::BaseBulkRound(const Group &group,
      const PrivateIdentity &ident,
      const Id &round_id,
      const QSharedPointer<Network> &network,
      GetDataCallback &get_data,
      const QSharedPointer<BuddyMonitor> &bm,
      CreateRound create_shuffle) :
    Round(group, ident, round_id, network, get_data, bm),
    _get_shuffle_data(this, &BaseBulkRound::GetShuffleData)
  {
    QVariantHash headers = GetNetwork()->GetHeaders();
    headers["bulk"] = true;
    GetNetwork()->SetHeaders(headers);

    QSharedPointer<Network> net(GetNetwork()->Clone());
    headers["bulk"] = false;
    net->SetHeaders(headers);

    Id sr_id(Hash().ComputeHash(GetRoundId().GetByteArray()));

    _shuffle_round = create_shuffle(GetGroup(), GetPrivateIdentity(), sr_id, net,
        _get_shuffle_data, bm);
    _shuffle_round->SetSink(&_shuffle_sink);

    QObject::connect(_shuffle_round.data(), SIGNAL(Finished()),
        this, SLOT(SlotShuffleFinished()));
  }
Пример #2
0
  void BulkRound::PrepareBlameShuffle()
  {
    QSharedPointer<Network> net(GetNetwork()->Clone());
    QVariantHash headers = net->GetHeaders();
    headers["bulk"] = false;
    net->SetHeaders(headers);

    Hash hashalgo;
    QByteArray roundid = GetRoundId().GetByteArray();
    roundid = hashalgo.ComputeHash(roundid);
    roundid = hashalgo.ComputeHash(roundid);
    Id sr_id(roundid);

    _shuffle_round = _create_shuffle(GetGroup(), GetPrivateIdentity(), sr_id, net,
        _get_blame_data);

    _shuffle_round->SetSink(&_shuffle_sink);

    QObject::connect(_shuffle_round.data(), SIGNAL(Finished()),
        this, SLOT(BlameShuffleFinished()));
  }