+-- Copyright (c) 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.
+
-- A SimGrid Lua implementation of the Bittorrent protocol.
require("simgrid")
i = math.random(1,#tracker_data.peers_list)
end
while #peers < #tracker_data.peers_list and #peers < common_tracker.MAXIMUM_PEERS do
- table.insert(peers,tracker_data.peers_list[i])
- i = (i + 1) % #tracker_data.peers_list
+ table.insert(peers,tracker_data.peers_list[i])
+ i = (i % #tracker_data.peers_list) +1
end
task.type = "ANSWER"
task.peers = peers