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:
parent
2634e63e4f
commit
11f39acef5
2 changed files with 34 additions and 21 deletions
|
@ -78,7 +78,6 @@ td::Status OverlayFecBroadcastPart::check_signature() {
|
|||
}
|
||||
|
||||
td::Status OverlayFecBroadcastPart::run_checks() {
|
||||
|
||||
TRY_STATUS(check_time());
|
||||
TRY_STATUS(check_duplicate());
|
||||
TRY_STATUS(check_source());
|
||||
|
@ -94,14 +93,17 @@ void BroadcastFec::broadcast_checked(td::Result<td::Unit> R) {
|
|||
overlay_->deliver_broadcast(get_source().compute_short_id(), data_.clone());
|
||||
auto manager = overlay_->overlay_manager();
|
||||
while (!parts_.empty()) {
|
||||
distribute_part(parts_.begin()->first);
|
||||
distribute_part(parts_.begin()->first);
|
||||
}
|
||||
|
||||
is_checked_ = true;
|
||||
}
|
||||
|
||||
// Do we need status here??
|
||||
td::Status BroadcastFec::distribute_part(td::uint32 seqno) {
|
||||
td::Status BroadcastFec::distribute_part(td::uint32 seqno) {
|
||||
auto i = parts_.find(seqno);
|
||||
if (i == parts_.end()) {
|
||||
VLOG(OVERLAY_WARNING) << "not distibuting empty part " << seqno;
|
||||
// should not get here
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
@ -132,7 +134,6 @@ td::Status BroadcastFec::distribute_part(td::uint32 seqno) {
|
|||
}
|
||||
|
||||
td::Status OverlayFecBroadcastPart::apply() {
|
||||
|
||||
if (!bcast_) {
|
||||
bcast_ = overlay_->get_fec_broadcast(broadcast_hash_);
|
||||
}
|
||||
|
@ -165,16 +166,20 @@ td::Status OverlayFecBroadcastPart::apply() {
|
|||
return S;
|
||||
}
|
||||
} else {
|
||||
if(untrusted_) {
|
||||
if (untrusted_) {
|
||||
auto P = td::PromiseCreator::lambda(
|
||||
[id = broadcast_hash_, overlay_id = actor_id(overlay_)](td::Result<td::Unit> RR) mutable {
|
||||
td::actor::send_closure(std::move(overlay_id), &OverlayImpl::broadcast_checked, id, std::move(RR));
|
||||
});
|
||||
[id = broadcast_hash_, overlay_id = actor_id(overlay_)](td::Result<td::Unit> RR) mutable {
|
||||
td::actor::send_closure(std::move(overlay_id), &OverlayImpl::broadcast_checked, id, std::move(RR));
|
||||
});
|
||||
overlay_->check_broadcast(bcast_->get_source().compute_short_id(), R.move_as_ok(), std::move(P));
|
||||
} else {
|
||||
overlay_->deliver_broadcast(bcast_->get_source().compute_short_id(), R.move_as_ok());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bcast_->set_overlay(overlay_);
|
||||
bcast_->set_src_peer_id(src_peer_id_);
|
||||
TRY_STATUS(bcast_->add_part(seqno_, data_.clone(), export_serialized_short(), export_serialized()));
|
||||
}
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
@ -304,7 +309,8 @@ td::Status OverlayFecBroadcastPart::create_new(OverlayImpl *overlay, td::actor::
|
|||
|
||||
auto B = std::make_unique<OverlayFecBroadcastPart>(
|
||||
broadcast_hash, part_hash, PublicKey{}, overlay->get_certificate(local_id), data_hash, size, flags,
|
||||
part_data_hash, std::move(part), seqno, std::move(fec_type), date, td::BufferSlice{}, false, nullptr, overlay, adnl::AdnlNodeIdShort::zero());
|
||||
part_data_hash, std::move(part), seqno, std::move(fec_type), date, td::BufferSlice{}, false, nullptr, overlay,
|
||||
adnl::AdnlNodeIdShort::zero());
|
||||
auto to_sign = B->to_sign();
|
||||
|
||||
auto P = td::PromiseCreator::lambda(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue