Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #417 from ipfs/fix/peermgr-race
Browse files Browse the repository at this point in the history
Fix PeerManager signalAvailabiity() race
  • Loading branch information
Stebalien authored Jun 10, 2020
2 parents 25318da + 980ca8d commit 06129d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/peermanager/peermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ func (pm *PeerManager) UnregisterSession(ses uint64) {
// signalAvailability is called when a peer's connectivity changes.
// It informs interested sessions.
func (pm *PeerManager) signalAvailability(p peer.ID, isConnected bool) {
pm.psLk.Lock()
defer pm.psLk.Unlock()

sesIds, ok := pm.peerSessions[p]
if !ok {
return
Expand Down

0 comments on commit 06129d6

Please sign in to comment.