remove Peer.Version

further shrinking the Peer API
This commit is contained in:
Matthias Radestock committed 2015-05-11 17:19:35 +01:00
1 parent 0229185ffe
commit 5bf6889250
2 files changed
+2 -8

No files matched your search

-6
View File
@@ -42,12 +42,6 @@ func (peer *Peer) Info() string {
return fmt.Sprint(peer.String(), " (v", peer.version, ") (UID ", peer.UID, ")")
}
func (peer *Peer) Version() uint64 {
peer.RLock()
defer peer.RUnlock()
return peer.version
}
func (peer *Peer) Connections() ConnectionSet {
connections := make(ConnectionSet)
peer.RLock()
+2 -2
View File
@@ -242,7 +242,7 @@ func (peers *Peers) applyUpdate(decodedUpdate []*Peer, decodedConns [][]Connecti
// guaranteed to find peer in the peers.table
peer := peers.table[name]
if peer != newPeer &&
(peer == peers.ourself.Peer || peer.Version() >= newPeer.Version()) {
(peer == peers.ourself.Peer || peer.version >= newPeer.version) {
// Nobody but us updates us. And if we know more about a
// peer than what's in the the update, we ignore the
// latter.
@@ -259,7 +259,7 @@ func (peers *Peers) applyUpdate(decodedUpdate []*Peer, decodedConns [][]Connecti
// 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.SetVersionAndConnections(newPeer.version, conns)
newUpdate[name] = peer
}
return newUpdate