1
0
mirror of https://github.com/matrix-org/pinecone.git synced 2026-10-24 11:59:18 +03:00

Reinstate mutex

This commit is contained in:
Neil Alexander
2021-05-11 16:03:33 +01:00
parent a04f3f8a96
commit b6ba2038e2

View File

@@ -220,9 +220,9 @@ func (t *virtualSnake) getVirtualSnakeNextHop(from *Peer, destKey types.PublicKe
// Finally, look at our direct peers, in case of any of our direct
// peers end up being a better path than anything else we've come up
// with so far.
//peer.mutex.RLock()
peer.mutex.RLock()
peerKey := peer.public
//peer.mutex.RUnlock()
peer.mutex.RUnlock()
switch {
case !bootstrap && peerKey.EqualTo(destKey):
newCandidate(peerKey, peer.port)
@@ -233,9 +233,9 @@ func (t *virtualSnake) getVirtualSnakeNextHop(from *Peer, destKey types.PublicKe
if bootstrap {
return types.SwitchPorts{bestPort}
} else if PortCount-canlength == 0 {
return types.SwitchPorts{0} // TODO: EXPERIMENTAL! Remove this!
return types.SwitchPorts{0} // TODO: Experimental - remove soon.
} else {
return types.SwitchPorts{bestPort} // candidates[canlength:]
return candidates[canlength:]
}
}