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

Add network id to dht (#559)

Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
EmelyanenkoK 2022-12-20 14:26:39 +03:00 committed by GitHub
parent 15cdfb0462
commit 3ff50f5f47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 231 additions and 172 deletions

View file

@ -40,6 +40,7 @@ class DhtRemoteNode {
DhtNode node_;
td::uint32 max_missed_pings_;
td::int32 our_network_id_;
td::uint32 missed_pings_ = 0;
double last_ping_at_ = 0;
double ready_from_ = 0;
@ -47,12 +48,13 @@ class DhtRemoteNode {
td::int32 version_;
public:
DhtRemoteNode(DhtNode node, td::uint32 max_missed_pings)
: node_(std::move(node)), max_missed_pings_(max_missed_pings) {
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();
}
static td::Result<std::unique_ptr<DhtRemoteNode>> create(DhtNode node, td::uint32 max_missed_pings);
static td::Result<std::unique_ptr<DhtRemoteNode>> create(DhtNode node, td::uint32 max_missed_pings,
td::int32 our_network_id);
DhtNode get_node() const {
return node_.clone();
}