Skip to content

Commit

Permalink
fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardpaulus committed May 6, 2012
1 parent cd71cbf commit 7aa3657
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions erlang/project/ld_cons.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ start(Epoch_Conss, Epoch_Changes) when
init(Peers, Epoch_Cons, Epoch_Chang) ->
Self = self(),
L0 = monarch_eld:max_rank(Peers, sets:from_list(Peers)),
Epoch_Cons ! {suscribe, self()},
Epoch_Chang ! {suscribe, self()},
Epoch_Cons ! {subscribe, self()},
Epoch_Chang ! {subscribe, self()},

%% init propose condition
condition:start(),
Expand Down Expand Up @@ -92,6 +92,7 @@ ldc_loop(State) ->
%% There is a new epoch, abort
{startepoch, New_TS, New_L} ->
#ldc_state{epoch_cons = EC} = State,
io:format("~p startepoch ~p ~p", [self(), New_TS, New_L]),
EC ! {abort, Self, New_TS},
ldc_loop(State#ldc_state{newts = New_TS, newl = New_L});

Expand All @@ -100,6 +101,7 @@ ldc_loop(State) ->
#ldc_state{epoch_cons = EC, newts = New_TS, newl = New_L} = State,
%% initialize a new instance of epoch consensus with timestamp ets
%% Epoch_Cons = rw_epoch_cons:start(Beb, Link, New_TS, Abo_State),
io:format("~p reinit", [self()]),
Epoch_Cons = rw_epoch_cons:reinit(EC, New_TS, Abo_State),
New_State = State#ldc_state{proposed = false, ets = New_TS, lead = New_L, epoch_cons = Epoch_Cons},
condition:check(New_State),
Expand All @@ -110,7 +112,7 @@ ldc_loop(State) ->
#ldc_state{decided = D, my_ups = My_Ups} = State,
case D of
false ->
%% io:format("We have decided on value ~p ~n", [Val]),
io:format("~p decided ~p ~n", [self(), Val]),
[Up ! {decide, Val, Ets} || Up <- My_Ups],
ldc_loop(State#ldc_state{decided = true});
true ->
Expand Down
8 changes: 4 additions & 4 deletions erlang/project/test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ ldc() ->
%% The initial states of the epoch consensus
E_States = [{0, bottom} || _ <- Bebs],
%% The epoch consensus
Epoch_Conss = [E1, _E2, _E3] = rw_epoch_cons:start(Bebs, Links, 0, E_States),
Epoch_Conss = [_E1, _E2, _E3] = rw_epoch_cons:start(Bebs, Links, 0, E_States),
receive after 100 -> pass end,
%% The ldc object
_LDCs = [A, _B, _C] = ld_cons:start(Epoch_Conss, Epoch_Changes),

%% Debug mode
dbg:tracer(),
dbg:p(A,m),
dbg:p(E1,m),
%dbg:tracer(),
%dbg:p(A,m),
%dbg:p(E1,m),

receive after 100 -> pass end,
A ! {propose, myval}.
Expand Down

0 comments on commit 7aa3657

Please sign in to comment.