-/* Copyright (c) 2012. The SimGrid Team.
+/* Copyright (c) 2012-2015. 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 "tracker.h"
-#include <msg/msg.h>
+#include <simgrid/msg.h>
#include <xbt/RngStream.h>
static void task_free(void *data);
*/
int tracker(int argc, char *argv[])
{
- int i, key_elm;
- char *key;
- void *data_p;
-
- RngStream stream = RngStream_CreateStream("tracker");
+ int i;
+ RngStream stream = (RngStream) MSG_host_get_property_value(MSG_host_self(), "stream");
//Checking arguments
xbt_assert(argc == 2, "Wrong number of arguments for the tracker.");
//Retrieving end time
- double deadline = atof(argv[1]);
+ double deadline = xbt_str_parse_double(argv[1],"Invalid deadline: %s");
xbt_assert(deadline > 0, "Wrong deadline supplied");
//Building peers array
xbt_dynar_t peers_list = xbt_dynar_new(sizeof(int), NULL);
xbt_dynar_push_as(peers_list, int, data->peer_id);
}
//Sending peers to the peer
- int nb_peers = 0, next_peer;
+ int next_peer;
int peers_length = xbt_dynar_length(peers_list);
for (i = 0; i < MAXIMUM_PAIRS && i < peers_length; i++) {
do {
}
//Free the peers list
xbt_dynar_free(&peers_list);
- //Free the RngStream object.
- RngStream_DeleteStream(&stream);
XBT_INFO("Tracker is leaving");
*/
int is_in_list(xbt_dynar_t peers, int id)
{
- int i, elm;
+ unsigned i;
+ int elm;
xbt_dynar_foreach(peers, i, elm) {
if (elm == id) {
return 1;