simplied code

This commit is contained in:
Andre Henriques 2024-01-16 15:23:30 +00:00
parent 0dc9215672
commit bf9d0cd34a

View File

@ -335,7 +335,7 @@ defmodule Paxos do
{:get_value, inst, pid_to_inform} -> {:get_value, inst, pid_to_inform} ->
# IO.puts("#{state.name} get_value") # IO.puts("#{state.name} get_value")
if has_finished(state, inst, true) do if has_finished(state, inst, true) do
send(pid_to_inform, {:get_value_res_actual, inst, state.decided[inst]}) send(pid_to_inform, {:get_value_res, inst, state.decided[inst]})
end end
state state
@ -511,10 +511,7 @@ defmodule Paxos do
{_, t} = input {_, t} = input
receive do receive do
{:get_value_res, inst} -> {:get_value_res, inst} ->
check_and_apply(nil, inst, input, &get_decision_loop/1) check_and_apply(inst, inst, input, &get_decision_loop/1)
{:get_value_res_actual, inst, v} ->
check_and_apply(v, inst, input, &get_decision_loop/1)
x -> x ->
Process.send_after(self(), x, 500) Process.send_after(self(), x, 500)