X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5d6868de67d93a2de8b87a0dc151d1eded7776b4..ed005f04539de87dab9d6883c44ccc2f891136aa:/examples/c/app-bittorrent/app-bittorrent.c diff --git a/examples/c/app-bittorrent/app-bittorrent.c b/examples/c/app-bittorrent/app-bittorrent.c index fafe793971..da50940e44 100644 --- a/examples/c/app-bittorrent/app-bittorrent.c +++ b/examples/c/app-bittorrent/app-bittorrent.c @@ -20,6 +20,16 @@ int main(int argc, char* argv[]) simgrid_load_platform(argv[1]); + sg_host_t* host_list = sg_host_list(); + size_t host_count = sg_host_count(); + unsigned* seed = xbt_new(unsigned, host_count); + for (size_t i = 0; i < host_count; i++) { + seed[i] = i; + rand_r(&seed[i]); + sg_host_set_data(host_list[i], &seed[i]); + } + xbt_free(host_list); + simgrid_register_function("tracker", tracker_run); simgrid_register_function("peer", peer_run); @@ -27,5 +37,6 @@ int main(int argc, char* argv[]) simgrid_run(); + xbt_free(seed); return 0; }