Browse Source

add comment about eliding the lock on addrs read

pull/598/head
vyzo 6 years ago
parent
commit
4a4b14819a
  1. 4
      p2p/host/relay/autorelay.go

4
p2p/host/relay/autorelay.go

@ -136,7 +136,9 @@ again:
ar.mx.Unlock()
// this dance is necessary to cover the Private->Public->Private transition
// where we were already connected to enough relays while private and dropped
// the addrs while public
// the addrs while public.
// Note tht we don't need the lock for reading addrs, as the only writer is
// the current goroutine.
if ar.addrs == nil {
ar.updateAddrs()
}

Loading…
Cancel
Save