Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
only proceed files with an existing SimGrid copyright header
[simgrid.git] / examples / lua / chord / chord.lua
index 77e19d9..6e6df64 100644 (file)
@@ -1,5 +1,11 @@
 -- 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
@@ -65,7 +71,7 @@ function node(...)
 
     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
@@ -271,7 +277,7 @@ function remote_find_successor(ask_to, id)
         " 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
@@ -312,7 +318,7 @@ function remote_get_predecessor(ask_to)
   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