1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Fix bug of broadcast stop on receiving the last FEC piece (#1040)

This commit is contained in:
EmelyanenkoK 2024-06-27 15:44:51 +03:00 committed by GitHub
parent 2634e63e4f
commit 11f39acef5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 21 deletions

View file

@ -82,15 +82,15 @@ class BroadcastFec : public td::ListNode {
}
}
td::Status add_part(td::uint32 seqno, td::BufferSlice data,
td::BufferSlice serialized_fec_part_short,
td::Status add_part(td::uint32 seqno, td::BufferSlice data, td::BufferSlice serialized_fec_part_short,
td::BufferSlice serialized_fec_part) {
CHECK(decoder_);
td::fec::Symbol s;
s.id = seqno;
s.data = std::move(data);
if (decoder_) {
td::fec::Symbol s;
s.id = seqno;
s.data = std::move(data);
decoder_->add_symbol(std::move(s));
decoder_->add_symbol(std::move(s));
}
parts_[seqno] = std::pair<td::BufferSlice, td::BufferSlice>(std::move(serialized_fec_part_short),
std::move(serialized_fec_part));
@ -200,8 +200,13 @@ class BroadcastFec : public td::ListNode {
td::Status distribute_part(td::uint32 seqno);
bool is_checked() const {
return is_checked_;
}
private:
bool ready_ = false;
bool is_checked_ = false;
Overlay::BroadcastHash hash_;
Overlay::BroadcastDataHash data_hash_;
@ -281,7 +286,7 @@ class OverlayFecBroadcastPart : public td::ListNode {
, signature_(std::move(signature))
, is_short_(is_short)
, bcast_(bcast)
, overlay_(overlay)
, overlay_(overlay)
, src_peer_id_(src_peer_id) {
}
@ -300,7 +305,7 @@ class OverlayFecBroadcastPart : public td::ListNode {
signature_ = std::move(signature);
}
void update_overlay(OverlayImpl *overlay);
tl_object_ptr<ton_api::overlay_broadcastFec> export_tl();
tl_object_ptr<ton_api::overlay_broadcastFecShort> export_tl_short();
td::BufferSlice export_serialized();
@ -310,14 +315,16 @@ class OverlayFecBroadcastPart : public td::ListNode {
td::Status run() {
TRY_STATUS(run_checks());
TRY_STATUS(apply());
if(!untrusted_) {
if (!untrusted_ || bcast_->is_checked()) {
TRY_STATUS(distribute());
}
return td::Status::OK();
}
static td::Status create(OverlayImpl *overlay, adnl::AdnlNodeIdShort src_peer_id, tl_object_ptr<ton_api::overlay_broadcastFec> broadcast);
static td::Status create(OverlayImpl *overlay, adnl::AdnlNodeIdShort src_peer_id, tl_object_ptr<ton_api::overlay_broadcastFecShort> broadcast);
static td::Status create(OverlayImpl *overlay, adnl::AdnlNodeIdShort src_peer_id,
tl_object_ptr<ton_api::overlay_broadcastFec> broadcast);
static td::Status create(OverlayImpl *overlay, adnl::AdnlNodeIdShort src_peer_id,
tl_object_ptr<ton_api::overlay_broadcastFecShort> broadcast);
static td::Status create_new(OverlayImpl *overlay, td::actor::ActorId<OverlayImpl> overlay_actor_id,
PublicKeyHash local_id, Overlay::BroadcastDataHash data_hash, td::uint32 size,
td::uint32 flags, td::BufferSlice part, td::uint32 seqno, fec::FecType fec_type,