diff --git a/router/connection_maker.go b/router/connection_maker.go index 8f2045b1..349098be 100644 --- a/router/connection_maker.go +++ b/router/connection_maker.go @@ -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{}{} diff --git a/router/mocks_test.go b/router/mocks_test.go index d71aa280..82016bc2 100644 --- a/router/mocks_test.go +++ b/router/mocks_test.go @@ -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{}{} } diff --git a/router/peers.go b/router/peers.go index a0ff2cbe..1e9d7eca 100644 --- a/router/peers.go +++ b/router/peers.go @@ -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, diff --git a/router/router.go b/router/router.go index 297eca08..6e22b6d4 100644 --- a/router/router.go +++ b/router/router.go @@ -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