diff --git a/router/peer.go b/router/peer.go index 3c2e8576..5525caee 100644 --- a/router/peer.go +++ b/router/peer.go @@ -70,6 +70,13 @@ func (peer *Peer) ForEachConnection(fun func(PeerName, Connection)) { } } +func (peer *Peer) SetVersionAndConnections(version uint64, connections map[PeerName]Connection) { + peer.Lock() + defer peer.Unlock() + peer.version = version + peer.connections = connections +} + // Calculate the routing table from this peer to all peers reachable // from it, returning a "next hop" map of PeerNameX -> PeerNameY, // which says "in order to send a message to X, the peer should send @@ -137,13 +144,6 @@ func (peer *Peer) Routes(stopAt *Peer, symmetric bool) (bool, map[PeerName]PeerN return false, routes } -func (peer *Peer) SetVersionAndConnections(version uint64, connections map[PeerName]Connection) { - peer.Lock() - defer peer.Unlock() - peer.version = version - peer.connections = connections -} - func StartLocalPeer(name PeerName, router *Router) *LocalPeer { peer := &LocalPeer{Peer: NewPeer(name, 0, 0), Router: router} queryChan := make(chan *PeerInteraction, ChannelSize)