local next_check_predecessor_date = now + check_predecessor_delay
local next_lookup_date = now + lookup_delay
local next_check_predecessor_date = now + check_predecessor_delay
local next_lookup_date = now + lookup_delay
elseif now >= next_check_predecessor_date then
check_predecessor()
next_check_predecessor_date = simgrid.get_clock() + check_predecessor_delay
elseif now >= next_check_predecessor_date then
check_predecessor()
next_check_predecessor_date = simgrid.get_clock() + check_predecessor_delay
-- This function is called when the current node receives a task.
-- - task: the task received
function handle_task(task)
-- This function is called when the current node receives a task.
-- - task: the task received
function handle_task(task)
-- is my successor the successor?
if is_in_interval(task.request_id, my_node.id + 1, my_node.fingers[1]) then
-- is my successor the successor?
if is_in_interval(task.request_id, my_node.id + 1, my_node.fingers[1]) then
task.type = "find successor answer"
task.answer = my_node.fingers[1]
task:dsend(task.answer_to)
else
-- forward the request to the closest preceding finger in my table
task.type = "find successor answer"
task.answer = my_node.fingers[1]
task:dsend(task.answer_to)
else
-- forward the request to the closest preceding finger in my table
function closest_preceding_node(id)
for i = nb_bits, 1, -1 do
function closest_preceding_node(id)
for i = nb_bits, 1, -1 do
function find_successor(id)
if is_in_interval(id, my_node.id + 1, my_node.fingers[1]) then
function find_successor(id)
if is_in_interval(id, my_node.id + 1, my_node.fingers[1]) then
if task:send(ask_to, timeout) then
-- request successfully sent: wait for an answer
if task:send(ask_to, timeout) then
-- request successfully sent: wait for an answer
if task:send(ask_to, timeout) then
-- request successfully sent: wait for an answer
while true do
if task:send(ask_to, timeout) then
-- request successfully sent: wait for an answer
while true do