fix: add lock when deleting peer

This commit is contained in:
Anthony Laibe 2023-01-30 10:41:14 +01:00 committed by RichΛrd
parent d4473e9c46
commit 5ff87d8e65
1 changed files with 2 additions and 0 deletions

View File

@ -86,7 +86,9 @@ func (w *WakuNode) pingPeer(ctx context.Context, wg *sync.WaitGroup, peer peer.I
w.keepAliveMutex.Unlock()
logger.Debug("could not ping", zap.Error(res.Error))
} else {
w.keepAliveMutex.Lock()
delete(w.keepAliveFails, peer)
w.keepAliveMutex.Unlock()
}
case <-ctx.Done():
w.keepAliveMutex.Lock()