Skip to content

Commit 88e64fc

Browse files
committed
pm lock around pq
1 parent 66dfc47 commit 88e64fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bitswap/client/internal/peermanager/peermanager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ func (pm *PeerManager) Disconnected(p peer.ID) {
116116
// Note that this is just used to calculate latency.
117117
func (pm *PeerManager) ResponseReceived(p peer.ID, ks []cid.Cid) {
118118
pm.pqLk.RLock()
119-
pq, ok := pm.peerQueues[p]
120-
pm.pqLk.RUnlock()
119+
defer pm.pqLk.RUnlock()
121120

121+
pq, ok := pm.peerQueues[p]
122122
if ok {
123123
pq.ResponseReceived(ks)
124124
}

0 commit comments

Comments
 (0)