Networking bug fixes (#1684)

* call correct unsubscribe method for subnets

* correctly delegate closed connections in behaviour

* correct unsubscribe method name
This commit is contained in:
blacktemplar 2020-09-29 10:28:15 +02:00 committed by GitHub
parent 6c1d7f55bf
commit ae28773965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -828,9 +828,8 @@ impl<TSpec: EthSpec> NetworkBehaviour for Behaviour<TSpec> {
// 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.

View File

@ -306,7 +306,7 @@ fn spawn_service<T: BeaconChainTypes>(
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);