From 10fd36f5b5172de70fde3a9b980abf0dc2d1e4e4 Mon Sep 17 00:00:00 2001 From: sukun Date: Thu, 20 Jun 2024 22:36:05 +0530 Subject: [PATCH] pstoremanager: fix connectedness check --- p2p/host/pstoremanager/pstoremanager.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/p2p/host/pstoremanager/pstoremanager.go b/p2p/host/pstoremanager/pstoremanager.go index 93cc2a98d9..f4a20f8ac4 100644 --- a/p2p/host/pstoremanager/pstoremanager.go +++ b/p2p/host/pstoremanager/pstoremanager.go @@ -121,10 +121,12 @@ func (m *PeerstoreManager) background(ctx context.Context, sub event.Subscriptio // Check that the peer is actually not connected at this point. // This avoids a race condition where the Connected notification // is processed after this time has fired. - if m.network.Connectedness(p) != network.Connected { + switch m.network.Connectedness(p) { + case network.Connected, network.Limited: + default: m.pstore.RemovePeer(p) - delete(disconnected, p) } + delete(disconnected, p) } } case <-ctx.Done():