X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9b73466ada27682d1729f394549479da83ef4a99..4c4671eeabdfa4c951086939613eaccf7f2b973d:/examples/msg/bittorrent/bittorrent.c diff --git a/examples/msg/bittorrent/bittorrent.c b/examples/msg/bittorrent/bittorrent.c index 741cd2c74f..4fc3fb19e1 100644 --- a/examples/msg/bittorrent/bittorrent.c +++ b/examples/msg/bittorrent/bittorrent.c @@ -1,17 +1,16 @@ -/* Copyright (c) 2012-2013. The SimGrid Team. +/* Copyright (c) 2012-2016. 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. */ + #include "bittorrent.h" #include "peer.h" #include "tracker.h" -#include +#include #include -/** - * Bittorrent example launcher - */ +/** Bittorrent example launcher */ int main(int argc, char *argv[]) { xbt_dynar_t host_list; @@ -21,10 +20,7 @@ int main(int argc, char *argv[]) MSG_init(&argc, argv); /* Check the arguments */ - if (argc < 3) { - printf("Usage: %s platform_file deployment_file \n", argv[0]); - return -1; - } + xbt_assert (argc > 2, "Usage: %s platform_file deployment_file", argv[0]); const char *platform_file = argv[1]; const char *deployment_file = argv[2]; @@ -37,7 +33,7 @@ int main(int argc, char *argv[]) RngStream stream; snprintf(descr, sizeof descr, "RngSream<%s>", MSG_host_get_name(host)); stream = RngStream_CreateStream(descr); - MSG_host_set_data(host, stream); + MSG_host_set_property_value(host, "stream", (char*)stream, NULL); } MSG_function_register("tracker", tracker); @@ -48,7 +44,7 @@ int main(int argc, char *argv[]) MSG_main(); xbt_dynar_foreach(host_list, i, host) { - RngStream stream = MSG_host_get_data(host); + RngStream stream = (RngStream) MSG_host_get_property_value(host, "stream"); RngStream_DeleteStream(&stream); } xbt_dynar_free(&host_list);