peers use uuid to avoid duplicate connections

This commit is contained in:
Ethan Buchman
2015-07-10 03:05:25 +00:00
parent 9521e4e4e7
commit d0610845dc
20 changed files with 1209 additions and 3 deletions

View File

@@ -34,7 +34,9 @@ func NewPeerSet() *PeerSet {
}
}
// Returns false if peer with key (address) is already in set.
// Returns false if peer with key (uuid) is already in set.
// TODO: we may want to do other things like restrict how many peers
// we're willing to connect to behind a single IP
func (ps *PeerSet) Add(peer *Peer) bool {
ps.mtx.Lock()
defer ps.mtx.Unlock()