make PeerNameSet a more broadly used type

This commit is contained in:
Matthias Radestock committed 2015-04-06 11:45:17 +01:00
1 parent 74b3f8d44e
commit 6db12d682e
4 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -114,7 +114,7 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections() time.Duration {
validTarget := make(map[string]struct{})
// copy the set of things we are connected to, so we can access them without locking
ourConnectedPeers := make(map[PeerName]struct{})
ourConnectedPeers := make(PeerNameSet)
ourConnectedTargets := make(map[string]struct{})
for _, conn := range cm.ourself.Connections() {
ourConnectedPeers[conn.Remote().Name] = struct{}{}
+1 -1
View File
@@ -48,7 +48,7 @@ func newMockConnection(from, to *Peer) Connection {
}
func checkEqualConns(t *testing.T, ourName PeerName, got, wanted map[PeerName]Connection) {
checkConns := make(map[PeerName]struct{})
checkConns := make(PeerNameSet)
for _, conn := range wanted {
checkConns[conn.Remote().Name] = struct{}{}
}
+2
View File
@@ -23,6 +23,8 @@ type NameCollisionError struct {
Name PeerName
}
type PeerNameSet map[PeerName]struct{}
func NewPeers(ourself *Peer, onGC func(*Peer)) *Peers {
return &Peers{
ourself: ourself,
-2
View File
@@ -350,8 +350,6 @@ func handleSpecialFrame(relayConn *LocalConnection, sender *net.UDPAddr, frame [
// Gossiper methods - the Router is the topology Gossiper
type PeerNameSet map[PeerName]struct{}
type TopologyGossipData struct {
peers *Peers
update PeerNameSet