cosmetic: move a comment
This commit is contained in:
1 parent
b95d5ee182
commit
1a85990bdc
2 files changed
+11
-9
No files matched your search
@@ -514,15 +514,7 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder) {
|
|||||||
// receiver merges it with its own topology model. If the
|
// receiver merges it with its own topology model. If the
|
||||||
// payload is a subset of the receiver's topology, no
|
// payload is a subset of the receiver's topology, no
|
||||||
// further action is taken. Otherwise, the receiver sends
|
// further action is taken. Otherwise, the receiver sends
|
||||||
// out to all its connections an "improved" update:
|
// 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
|
|
||||||
conn.SendTCP(Concat(ProtocolUpdateByte, conn.Router.Peers.EncodeAllPeers()))
|
conn.SendTCP(Concat(ProtocolUpdateByte, conn.Router.Peers.EncodeAllPeers()))
|
||||||
case ProtocolUpdate:
|
case ProtocolUpdate:
|
||||||
newUpdate, err := conn.Router.Peers.ApplyUpdate(msg[1:])
|
newUpdate, err := conn.Router.Peers.ApplyUpdate(msg[1:])
|
||||||
|
|||||||
@@ -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) {
|
func (peers *Peers) ApplyUpdate(update []byte) ([]byte, error) {
|
||||||
peers.Lock()
|
peers.Lock()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user