From f5e6c9584bd3b86a3365358a7ba9bc8bd83c0644 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Thu, 23 Jul 2015 18:59:04 +0200 Subject: [PATCH] [Lua] Fixed kademlia.lua test - Index 0 was out of bounds - Updated tesh file --- examples/lua/kademlia/kademlia.tesh | 15 +++++++-------- examples/lua/kademlia/routing_table.lua | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/lua/kademlia/kademlia.tesh b/examples/lua/kademlia/kademlia.tesh index 2092ee82fe..216f069f65 100644 --- a/examples/lua/kademlia/kademlia.tesh +++ b/examples/lua/kademlia/kademlia.tesh @@ -11,17 +11,16 @@ $ lua kademlia.lua > [Tanguay:node:(11) 0.000000] [lua/INFO] Hi, I'm going to join the network with the id 1111111111 ! > [Morin:node:(12) 0.000000] [lua/INFO] Hi, I'm going to join the network with the id 11111111111 ! > [Ethernet:node:(13) 0.000000] [lua/INFO] Hi, I'm going to join the network with the id 11111111111 ! +> [Ethernet:node:(13) 900.000000] [lua/INFO] 8/8 FIND_NODE have succedded > [Morin:node:(12) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded > [Tanguay:node:(11) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded -> [iRMX:node:(7) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded +> [McGee:node:(8) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded > [Gatien:node:(9) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded -> [TeX:node:(4) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded -> [Laroche:node:(10) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded +> [iRMX:node:(7) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded > [Disney:node:(6) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded -> [Geoff:node:(5) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded -> [McGee:node:(8) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded > [Jean_Yves:node:(3) 900.000000] [lua/INFO] 8/8 FIND_NODE have succedded -> [Jacquelin:node:(1) 900.000000] [lua/INFO] 0/8 FIND_NODE have succedded +> [Geoff:node:(5) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded +> [Laroche:node:(10) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded +> [TeX:node:(4) 900.000000] [lua/INFO] 7/7 FIND_NODE have succedded > [Boivin:node:(2) 900.000000] [lua/INFO] 8/8 FIND_NODE have succedded -> [Ethernet:node:(13) 900.000000] [lua/INFO] 8/8 FIND_NODE have succedded - +> [Jacquelin:node:(1) 900.000000] [lua/INFO] 0/8 FIND_NODE have succedded diff --git a/examples/lua/kademlia/routing_table.lua b/examples/lua/kademlia/routing_table.lua index d4f4d045a4..089cc89d92 100644 --- a/examples/lua/kademlia/routing_table.lua +++ b/examples/lua/kademlia/routing_table.lua @@ -52,7 +52,7 @@ function routing_table_update(id) simgrid.debug("Updating " .. id .. " in my routing table") -- If the element is already in the bucket, we update it. table.remove(bucket.list,index_of(bucket.list,id)) - table.insert(bucket.list,0,id) + table.insert(bucket.list,id) else simgrid.debug("Insert " .. id .. " in my routing table in bucket " .. bucket.id) table.insert(bucket.list,id) @@ -95,4 +95,4 @@ function find_closest(destination_id) end return answer -end \ No newline at end of file +end -- 2.20.1