11// Unreliably send event `e` with payload `p` to every `target`
2- fun UnreliableBroadcast (targets :set [machine ],e :event ,payload :any ) {
2+ fun UnreliableBroadcast (target_machines :set [machine ],e :event ,payload :any ) {
33var i :int ;
4- while (i < sizeof(targets )) {
4+ while (i < sizeof(target_machines )) {
55if (choose()) {
6- send targets [i ],e , payload;
6+ send target_machines [i ],e , payload;
77}
88i = i + 1 ;
99}
1010}
1111
1212// Unreliably send event `e` with payload `p` to every `target`, potentially multiple times
13- fun UnreliableBroadcastMulti(targets :set [machine ],e :event ,payload :any ) {
13+ fun UnreliableBroadcastMulti(target_machines :set [machine ],e :event ,payload :any ) {
1414var i : int;
1515var n : int;
1616var k : int;
1717
18- while (i <sizeof (targets )) {
18+ while (i <sizeof (target_machines )) {
1919//Each message is sent `k `is that number of times
2020k =choose (3 );
2121//Times we 've sent the packet so far
2222n =0 ;
2323while (n <k ) {
24- send targets [i ],e ,payload ;
24+ send target_machines [i ],e ,payload ;
2525n =n +1 ;
2626}
2727i =i +1 ;
2828}
2929}
3030
3131//Reliably send event `e `with payload `p `to every `target `
32- fun ReliableBroadcast (targets :set [machine ],e :event ,payload :any ) {
32+ fun ReliableBroadcast (target_machines :set [machine ],e :event ,payload :any ) {
3333var i :int ;
34- while (i <sizeof (targets )) {
35- send targets [i ],e ,payload ;
34+ while (i <sizeof (target_machines )) {
35+ send target_machines [i ],e ,payload ;
3636i =i +1 ;
3737}
3838}
3939
4040//Reliably send event `e `with payload `p `to a majority of `target `.Unreliable send to remaining ,potentially multiple times .
41- fun ReliableBroadcastMajority (targets :set [machine ],e :event ,payload :any ) {
41+ fun ReliableBroadcastMajority (target_machines :set [machine ],e :event ,payload :any ) {
4242var i :int ;
4343var n :int ;
4444var k :int ;
4545var majority :int ;
4646
47- majority =sizeof (targets ) /2 +1 ;
47+ majority =sizeof (target_machines ) /2 +1 ;
4848
49- while (i <sizeof (targets )) {
49+ while (i <sizeof (target_machines )) {
5050//Each message is sent `k `is that number of times
5151k =1 ;
5252if (i >=majority ) {
@@ -55,7 +55,7 @@ fun ReliableBroadcastMajority(targets: set[machine], e: event, payload: any) {
5555//Times we 've sent the packet so far
5656n =0 ;
5757while (n <k ) {
58- send targets [i ],e ,payload ;
58+ send target_machines [i ],e ,payload ;
5959n =n +1 ;
6060}
6161i =i +1 ;