Skip to content

Commit

Permalink
pstoremanager: fix connectedness check
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt authored and MarcoPolo committed Jun 25, 2024
1 parent 87c4355 commit 10fd36f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions p2p/host/pstoremanager/pstoremanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 10fd36f

Please sign in to comment.