mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Improve handling backup nodes in dht (#562)
This commit is contained in:
parent
360ef54e6b
commit
dd9cdba587
6 changed files with 100 additions and 47 deletions
|
@ -45,14 +45,11 @@ class DhtRemoteNode {
|
|||
double last_ping_at_ = 0;
|
||||
double ready_from_ = 0;
|
||||
double failed_from_ = 0;
|
||||
double ping_interval_;
|
||||
td::int32 version_;
|
||||
|
||||
public:
|
||||
DhtRemoteNode(DhtNode node, td::uint32 max_missed_pings, td::int32 our_network_id)
|
||||
: node_(std::move(node)), max_missed_pings_(max_missed_pings), our_network_id_(our_network_id) {
|
||||
failed_from_ = td::Time::now_cached();
|
||||
id_ = node_.get_key();
|
||||
}
|
||||
DhtRemoteNode(DhtNode node, td::uint32 max_missed_pings, td::int32 our_network_id);
|
||||
static td::Result<std::unique_ptr<DhtRemoteNode>> create(DhtNode node, td::uint32 max_missed_pings,
|
||||
td::int32 our_network_id);
|
||||
DhtNode get_node() const {
|
||||
|
@ -78,9 +75,13 @@ class DhtRemoteNode {
|
|||
double last_ping_at() const {
|
||||
return last_ping_at_;
|
||||
}
|
||||
double ping_interval() const {
|
||||
return ping_interval_;
|
||||
}
|
||||
void send_ping(bool client_only, td::actor::ActorId<adnl::Adnl> adnl, td::actor::ActorId<DhtMember> node,
|
||||
adnl::AdnlNodeIdShort src);
|
||||
td::Status receive_ping(DhtNode node, td::actor::ActorId<adnl::Adnl> adnl, adnl::AdnlNodeIdShort self_id);
|
||||
void receive_ping();
|
||||
td::Status update_value(DhtNode node, td::actor::ActorId<adnl::Adnl> adnl, adnl::AdnlNodeIdShort self_id);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue