aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/peers.md24
1 files changed, 20 insertions, 4 deletions
diff --git a/docs/peers.md b/docs/peers.md
index d5403c1..1219149 100644
--- a/docs/peers.md
+++ b/docs/peers.md
@@ -341,10 +341,26 @@ out about half the sync messages, Automerge's answers that only say "I have your
heads": along trees, to pulls, to what is sent again. Should the message be lost, the
peer still lacks it: one that pulled asks again after its reply timeout; a child in a
tree is told by its other neighbours in their slow rounds (below), and pulls (one that
-reaches no other member, by its parent's), or can't apply the next message and asks. The announcement
-round of a node that passed changes on goes only to the neighbours the tree leaves out
-(no member they reach comes before them, or the member list's graph doesn't have
-them); all others are told in a slow round 2 s later, which catches what a tree missed
+reaches no other member, by its parent's), or can't apply the next message and asks for
+what it lacks, and gets just that, and what that builds on, again (not what was sent
+after it: that may only be late).
+
+As nobody waits for these answers, messages overtake each other on slow links. Three
+things keep that from sending changes twice (`document::sync`):
+
+* A message names what its sender last shared with the receiver by heads, and for one
+ taken as delivered, those are the heads its predecessor brought. Where the
+ predecessor is still on its way, the receiver lacks them; Automerge would take that
+ for lost data and answer with a reset, after which the sender sends everything
+ again. So heads the receiver lacks give way to those it shares with the sender.
+* The changes a message brought count as already sent to its sender, which has them:
+ an answer never carries them back.
+* A message that turns out older than the last from its sender, once all of it is in,
+ leaves the receiver level with the newer one: it says nothing.
+
+The announcement round of a node that passed changes on goes only to the neighbours the
+tree leaves out (no member they reach comes before them, or the member list's graph
+doesn't have them); all others are told in a slow round 2 s later, which catches what a tree missed
(a parent that went away, nodes whose views of the tree differed, the last of a run of
messages along a tree lost) and covers everything that came meanwhile: while changes
keep coming, each neighbour gets an announcement about every 2 s, not with every