From 1a85990bdc6a42db8afb8967ea43bf297d35c5f3 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 19 Jan 2015 14:51:59 +0000 Subject: [PATCH] cosmetic: move a comment --- router/connection.go | 10 +--------- router/peers.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/router/connection.go b/router/connection.go index a79abca8..e004d65e 100644 --- a/router/connection.go +++ b/router/connection.go @@ -514,15 +514,7 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder) { // receiver merges it with its own topology model. If the // payload is a subset of the receiver's topology, no // further action is taken. Otherwise, the receiver sends - // out to all its connections an "improved" update: - // - elements which the original payload added to the - // receiver are included - // - elements which the original payload updated in the - // receiver are included - // - elements which are equal between the receiver and - // the payload are not included - // - elements where the payload was older than the - // receiver's version are updated + // out to all its connections an "improved" update. conn.SendTCP(Concat(ProtocolUpdateByte, conn.Router.Peers.EncodeAllPeers())) case ProtocolUpdate: newUpdate, err := conn.Router.Peers.ApplyUpdate(msg[1:]) diff --git a/router/peers.go b/router/peers.go index 071fb5e0..cb85ad47 100644 --- a/router/peers.go +++ b/router/peers.go @@ -57,6 +57,16 @@ func (peers *Peers) ForEach(fun func(PeerName, *Peer)) { } } +// Merge an incoming update with our own topology, and +// create an "improved" update: +// - elements which the original payload added to the receiver are +// included +// - elements which the original payload updated in the receiver are +// included +// - elements which are equal between the receiver and the payload are +// not included +// - elements where the payload was older than the receiver's version +// are updated func (peers *Peers) ApplyUpdate(update []byte) ([]byte, error) { peers.Lock()