diff --git a/router/gossip_test.go b/router/gossip_test.go index 09240735..9128ab39 100644 --- a/router/gossip_test.go +++ b/router/gossip_test.go @@ -79,7 +79,8 @@ func (router *Router) tp(routers ...*Router) *Peer { p := NewPeer(r.Ourself.Peer.Name, "", r.Ourself.Peer.UID, r.Ourself.Peer.version) connections[r.Ourself.Peer.Name] = newMockConnection(peer, p) } - peer.SetVersionAndConnections(router.Ourself.Peer.version, connections) + peer.version = router.Ourself.Peer.version + peer.connections = connections return peer } diff --git a/router/peer.go b/router/peer.go index 0ec4172a..46d024b0 100644 --- a/router/peer.go +++ b/router/peer.go @@ -42,13 +42,6 @@ func (peer *Peer) Info() string { return fmt.Sprint(peer.String(), " (v", peer.version, ") (UID ", peer.UID, ")") } -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 diff --git a/router/peers.go b/router/peers.go index 45e5a75c..6a5606d9 100644 --- a/router/peers.go +++ b/router/peers.go @@ -270,8 +270,8 @@ func (peers *Peers) applyUpdate(decodedUpdate []*Peer, decodedConns [][]Connecti // for an update would be someone else calling // router.Peers.ApplyUpdate. But ApplyUpdate takes the Lock on // the router.Peers, so there can be no race here. - conns := makeConnsMap(peer, connSummaries, peers.table) - peer.SetVersionAndConnections(newPeer.version, conns) + peer.version = newPeer.version + peer.connections = makeConnsMap(peer, connSummaries, peers.table) newUpdate[name] = peer } return newUpdate