Skip to content

Commit

Permalink
fix: close peer manager before sending goodbye to all peers
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Jul 12, 2023
1 parent 0640e06 commit a8bd735
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/beacon-node/src/network/core/networkCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,13 @@ export class NetworkCore implements INetworkCore {

this.clock.off(ClockEvent.epoch, this.onEpoch);

// Must close peer manager before disconnecting peers to
// prevent registering newly discovered peers afterwards
await this.peerManager.close();
this.logger.debug("network peerManager closed");
// Must goodbye and disconnect before stopping libp2p
await this.peerManager.goodbyeAndDisconnectAllPeers();
this.logger.debug("network sent goodbye to all peers");
await this.peerManager.close();
this.logger.debug("network peerManager closed");
await this.gossip.stop();
this.logger.debug("network gossip closed");
await this.reqResp.stop();
Expand Down

0 comments on commit a8bd735

Please sign in to comment.