-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerfect using Fair-Loss.txt
34 lines (28 loc) · 1.06 KB
/
Perfect using Fair-Loss.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Definitions:
Fair-loss link:
Fair-loss: if a msg is sent infinitely
often by pi to pj and none of them crashes
then the msg is delivered infinitely often to pj.
Finite duplication: if a msg m is sent a finite number
of times by pi to pj, then the msg is delivered a
finite number of times by pj.
No creation: no msg is delivered unless it was sent.
Reliable (Perfect) link:
Validity: if pi and pj are correct then every msg sent by
pi to pj is eventually delivered by pj
No duplication: No msg is delivered more than once
No creation
------------------------------------------------------------------
Algo:
// NOT SURE
implements: Perfect Links (pp2p)
uses Fair Loss Links (flp2p)
upon event <Init> do delivered = Null
upon event <pp2pSend, dest, m> do
while (!delivered.contains(m))
trigger <flp2pSend, dest, m>
sleep <1000>
upon event <flp2pDeliver, src, m> do
if (delivered.contains(m)) then
trigger <pp2pDeliver, src, m>
delivered.add(m)