-- A SimGrid Lua implementation of the Chord DHT
+-- Copyright (c) 2011-2012, 2014. The SimGrid Team.
+-- All rights reserved.
+
+-- This program is free software; you can redistribute it and/or modify it
+-- under the terms of the license (GNU LGPL) which comes with this package.
+
require("simgrid")
nb_bits = 24
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
" 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
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