From ae287739659c5dd4101691cf674f6886fab5113b Mon Sep 17 00:00:00 2001 From: blacktemplar Date: Tue, 29 Sep 2020 10:28:15 +0200 Subject: [PATCH] Networking bug fixes (#1684) * call correct unsubscribe method for subnets * correctly delegate closed connections in behaviour * correct unsubscribe method name --- beacon_node/eth2_libp2p/src/behaviour/mod.rs | 3 +-- beacon_node/network/src/service.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/beacon_node/eth2_libp2p/src/behaviour/mod.rs b/beacon_node/eth2_libp2p/src/behaviour/mod.rs index 716af9eb5b..143b59f4f9 100644 --- a/beacon_node/eth2_libp2p/src/behaviour/mod.rs +++ b/beacon_node/eth2_libp2p/src/behaviour/mod.rs @@ -828,9 +828,8 @@ impl NetworkBehaviour for Behaviour { // If the peer manager (and therefore the behaviour's) believe this peer connected, inform // about the disconnection. if self.network_globals.peers.read().is_connected(&peer_id) { - return; + delegate_to_behaviours!(self, inject_connection_closed, peer_id, conn_id, endpoint); } - delegate_to_behaviours!(self, inject_connection_closed, peer_id, conn_id, endpoint); } // This gets called once there are no more active connections. diff --git a/beacon_node/network/src/service.rs b/beacon_node/network/src/service.rs index a018750f3f..1147562b4c 100644 --- a/beacon_node/network/src/service.rs +++ b/beacon_node/network/src/service.rs @@ -306,7 +306,7 @@ fn spawn_service( service.libp2p.swarm.subscribe_to_subnet(subnet_id); } AttServiceMessage::Unsubscribe(subnet_id) => { - service.libp2p.swarm.subscribe_to_subnet(subnet_id); + service.libp2p.swarm.unsubscribe_from_subnet(subnet_id); } AttServiceMessage::EnrAdd(subnet_id) => { service.libp2p.swarm.update_enr_subnet(subnet_id, true);