From c5d6fd3f36a58b9391459b6203e78144d0fbf5ea Mon Sep 17 00:00:00 2001 From: turuslan Date: Thu, 19 Dec 2024 13:43:45 +0500 Subject: [PATCH 1/2] peerCount out, getConnections closed Signed-off-by: turuslan --- core/network/notifications/protocol.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/network/notifications/protocol.cpp b/core/network/notifications/protocol.cpp index 0a58cfcd62..899dede031 100644 --- a/core/network/notifications/protocol.cpp +++ b/core/network/notifications/protocol.cpp @@ -385,6 +385,10 @@ namespace kagome::network::notifications { } for (auto &conn : host_->getNetwork().getConnectionManager().getConnections()) { + // TODO(turuslan): https://github.com/libp2p/cpp-libp2p/pull/285 + if (conn->isClosed()) { + continue; + } auto peer_id = conn->remotePeer().value(); if (reserved_.contains(peer_id)) { continue; @@ -402,7 +406,7 @@ namespace kagome::network::notifications { size_t Protocol::peerCount(bool out) { size_t count = 0; - if (out) { + if (not out) { for (auto &p : peers_in_) { if (reserved_.contains(p.first)) { continue; From 0a5a267bdb4af7b688115750268e6cd01c37be47 Mon Sep 17 00:00:00 2001 From: turuslan Date: Thu, 19 Dec 2024 13:48:28 +0500 Subject: [PATCH 2/2] update libp2p Signed-off-by: turuslan --- cmake/Hunter/config.cmake | 3 ++- core/network/notifications/protocol.cpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index bbd1efe960..9aefcfdef5 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -105,7 +105,8 @@ hunter_config( hunter_config( libp2p - VERSION 0.1.28 + URL https://github.com/libp2p/cpp-libp2p/archive/b183f881917e69c84f43099efcbbde894625376e.zip + SHA1 15ad9926f7b9dad339826ad30616e9ec415e5cb8 ) hunter_config( diff --git a/core/network/notifications/protocol.cpp b/core/network/notifications/protocol.cpp index 899dede031..29f37efc17 100644 --- a/core/network/notifications/protocol.cpp +++ b/core/network/notifications/protocol.cpp @@ -385,7 +385,6 @@ namespace kagome::network::notifications { } for (auto &conn : host_->getNetwork().getConnectionManager().getConnections()) { - // TODO(turuslan): https://github.com/libp2p/cpp-libp2p/pull/285 if (conn->isClosed()) { continue; }