A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix compilation with tracing and new network_element_t
[simgrid.git]
/
examples
/
lua
/
chord
/
chord.lua
diff --git
a/examples/lua/chord/chord.lua
b/examples/lua/chord/chord.lua
index
061ba66
..
523b150
100644
(file)
--- a/
examples/lua/chord/chord.lua
+++ b/
examples/lua/chord/chord.lua
@@
-65,7
+65,7
@@
function node(...)
while now < max_simulation_time do
while now < max_simulation_time do
- task, err =
simgrid.comm.test(my_node.comm_recv
)
+ task, err =
my_node.comm_recv:test(
)
if task then
-- I received a task: answer it
if task then
-- I received a task: answer it
@@
-130,28
+130,20
@@
function handle_task(task)
task.answer_to .. ": the successor of " .. task.request_id ..
" is " .. my_node.fingers[1])
task.answer_to .. ": the successor of " .. task.request_id ..
" is " .. my_node.fingers[1])
- local ans_task = simgrid.task.new("", comp_size, comm_size)
- ans_task.type = "find successor answer"
- ans_task.request_id = task.request_id
- ans_task.answer = my_node.fingers[1]
- ans_task:dsend(task.answer_to)
+ 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
simgrid.info("Forwarding the 'find successor' request to my closest preceding finger")
else
-- forward the request to the closest preceding finger in my table
simgrid.info("Forwarding the 'find successor' request to my closest preceding finger")
-
- local next_task = simgrid.task.new("", comp_size, comm_size)
- next_task.type = "find successor"
- next_task.request_id = task.request_id
- next_task.answer_to = task.answer_to
- next_task:dsend(closest_preceding_node(next_task.request_id))
+ task:dsend(closest_preceding_node(task.request_id))
end
elseif type == "get predecessor" then
end
elseif type == "get predecessor" then
- local ans_task = simgrid.task.new("", comp_size, comm_size)
- ans_task.type = "get predecessor answer"
- ans_task.answer = my_node.predecessor
- ans_task:dsend(task.answer_to)
+ task.type = "get predecessor answer"
+ task.answer = my_node.predecessor
+ task:dsend(task.answer_to)
elseif type == "notify" then
-- someone is telling me that he may be my new predecessor
elseif type == "notify" then
-- someone is telling me that he may be my new predecessor
@@
-279,7
+271,7
@@
function remote_find_successor(ask_to, id)
" for id " .. id .. ", waiting for the answer")
while true do
" for id " .. id .. ", waiting for the answer")
while true do
- task =
simgrid.comm.wait(my_node.comm_recv,
timeout)
+ task =
my_node.comm_recv:wait(
timeout)
my_node.comm_recv = simgrid.task.irecv(my_node.id)
if not task then
my_node.comm_recv = simgrid.task.irecv(my_node.id)
if not task then
@@
-320,7
+312,7
@@
function remote_get_predecessor(ask_to)
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
- task =
simgrid.comm.wait(my_node.comm_recv,
timeout)
+ task =
my_node.comm_recv:wait(
timeout)
my_node.comm_recv = simgrid.task.irecv(my_node.id)
if not task then
my_node.comm_recv = simgrid.task.irecv(my_node.id)
if not task then