mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Rename private ext msg overlays to custom overlays, change interface a bit (#952)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
0434eadc1f
commit
f7907bdd58
11 changed files with 121 additions and 125 deletions
|
@ -36,7 +36,7 @@ void FullNodeImpl::add_permanent_key(PublicKeyHash key, td::Promise<td::Unit> pr
|
|||
|
||||
local_keys_.insert(key);
|
||||
create_private_block_overlay(key);
|
||||
for (auto &p : private_ext_msg_overlays_) {
|
||||
for (auto &p : private_custom_overlays_) {
|
||||
update_ext_msg_overlay(p.first, p.second);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ void FullNodeImpl::del_permanent_key(PublicKeyHash key, td::Promise<td::Unit> pr
|
|||
}
|
||||
local_keys_.erase(key);
|
||||
private_block_overlays_.erase(key);
|
||||
for (auto &p : private_ext_msg_overlays_) {
|
||||
for (auto &p : private_custom_overlays_) {
|
||||
update_ext_msg_overlay(p.first, p.second);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ void FullNodeImpl::update_adnl_id(adnl::AdnlNodeIdShort adnl_id, td::Promise<td:
|
|||
}
|
||||
local_id_ = adnl_id_.pubkey_hash();
|
||||
|
||||
for (auto &p : private_ext_msg_overlays_) {
|
||||
for (auto &p : private_custom_overlays_) {
|
||||
update_ext_msg_overlay(p.first, p.second);
|
||||
}
|
||||
}
|
||||
|
@ -132,9 +132,9 @@ void FullNodeImpl::set_config(FullNodeConfig config) {
|
|||
for (auto& overlay : private_block_overlays_) {
|
||||
td::actor::send_closure(overlay.second, &FullNodePrivateBlockOverlay::set_config, config);
|
||||
}
|
||||
for (auto& overlay : private_ext_msg_overlays_) {
|
||||
for (auto& overlay : private_custom_overlays_) {
|
||||
for (auto &actor : overlay.second.actors_) {
|
||||
td::actor::send_closure(actor.second, &FullNodePrivateExtMsgOverlay::set_config, config);
|
||||
td::actor::send_closure(actor.second, &FullNodeCustomOverlay::set_config, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,13 +146,13 @@ void FullNodeImpl::add_ext_msg_overlay(std::vector<adnl::AdnlNodeIdShort> nodes,
|
|||
promise.set_error(td::Status::Error("list of nodes is empty"));
|
||||
return;
|
||||
}
|
||||
if (private_ext_msg_overlays_.count(name)) {
|
||||
if (private_custom_overlays_.count(name)) {
|
||||
promise.set_error(td::Status::Error(PSTRING() << "duplicate overlay name \"" << name << "\""));
|
||||
return;
|
||||
}
|
||||
VLOG(FULL_NODE_WARNING) << "Adding private overlay for external messages \"" << name << "\", " << nodes.size()
|
||||
<< " nodes";
|
||||
auto &p = private_ext_msg_overlays_[name];
|
||||
auto &p = private_custom_overlays_[name];
|
||||
p.nodes_ = nodes;
|
||||
p.senders_ = senders;
|
||||
update_ext_msg_overlay(name, p);
|
||||
|
@ -160,12 +160,12 @@ void FullNodeImpl::add_ext_msg_overlay(std::vector<adnl::AdnlNodeIdShort> nodes,
|
|||
}
|
||||
|
||||
void FullNodeImpl::del_ext_msg_overlay(std::string name, td::Promise<td::Unit> promise) {
|
||||
auto it = private_ext_msg_overlays_.find(name);
|
||||
if (it == private_ext_msg_overlays_.end()) {
|
||||
auto it = private_custom_overlays_.find(name);
|
||||
if (it == private_custom_overlays_.end()) {
|
||||
promise.set_error(td::Status::Error(PSTRING() << "no such overlay \"" << name << "\""));
|
||||
return;
|
||||
}
|
||||
private_ext_msg_overlays_.erase(it);
|
||||
private_custom_overlays_.erase(it);
|
||||
promise.set_result(td::Unit());
|
||||
}
|
||||
|
||||
|
@ -221,11 +221,11 @@ void FullNodeImpl::send_ext_message(AccountIdPrefixFull dst, td::BufferSlice dat
|
|||
VLOG(FULL_NODE_WARNING) << "dropping OUT ext message to unknown shard";
|
||||
return;
|
||||
}
|
||||
for (auto &private_overlay : private_ext_msg_overlays_) {
|
||||
for (auto &private_overlay : private_custom_overlays_) {
|
||||
for (auto &actor : private_overlay.second.actors_) {
|
||||
auto local_id = actor.first;
|
||||
if (private_overlay.second.senders_.count(local_id)) {
|
||||
td::actor::send_closure(actor.second, &FullNodePrivateExtMsgOverlay::send_external_message, data.clone());
|
||||
td::actor::send_closure(actor.second, &FullNodeCustomOverlay::send_external_message, data.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void FullNodeImpl::start_up() {
|
|||
}
|
||||
|
||||
void FullNodeImpl::update_private_overlays() {
|
||||
for (auto &p : private_ext_msg_overlays_) {
|
||||
for (auto &p : private_custom_overlays_) {
|
||||
update_ext_msg_overlay(p.first, p.second);
|
||||
}
|
||||
|
||||
|
@ -534,8 +534,8 @@ void FullNodeImpl::update_ext_msg_overlay(const std::string &name, ExtMsgOverlay
|
|||
overlay.actors_[local_id] = std::move(it->second);
|
||||
old_actors.erase(it);
|
||||
} else {
|
||||
overlay.actors_[local_id] = td::actor::create_actor<FullNodePrivateExtMsgOverlay>(
|
||||
"ExtMsgPrivateOverlay", local_id, overlay.nodes_, overlay.senders_, name, zero_state_file_hash_, config_,
|
||||
overlay.actors_[local_id] = td::actor::create_actor<FullNodeCustomOverlay>(
|
||||
"CustomOverlay", local_id, overlay.nodes_, overlay.senders_, name, zero_state_file_hash_, config_,
|
||||
keyring_, adnl_, rldp_, rldp2_, overlays_, validator_manager_);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue