coarser lock granularity
- get rid of individual Peer locks - hold Peers read (or write) lock and LocalPeer read lock while performing route calculations This eliminates the deadlock resulting from the inconsistent lock acquisition order in route calculcation. Fixes #643.
This commit is contained in:
1 parent
5bd8730353
commit
e246e6acc6
4 files changed
+16
-22
No files matched your search
@@ -182,7 +182,9 @@ func (peers *Peers) String() string {
|
||||
|
||||
func (peers *Peers) garbageCollect() []*Peer {
|
||||
removed := []*Peer{}
|
||||
peers.ourself.RLock()
|
||||
_, reached := peers.ourself.Routes(nil, false)
|
||||
peers.ourself.RUnlock()
|
||||
for name, peer := range peers.table {
|
||||
if _, found := reached[peer.Name]; !found && peer.localRefCount == 0 {
|
||||
delete(peers.table, name)
|
||||
|
||||
Reference in new issue
Block a user