/**
* How many peers do we start?
*/
-uint32_t num_peers;
+static uint32_t num_peers;
/**
* How long do we run the test?
*/
static int ok;
-
/**
* Identifier for the churn task that runs periodically
*/
static struct GNUNET_SCHEDULER_Task *churn_task;
-/**
- * Identifier for the churn task that runs periodically
- */
-static struct GNUNET_SCHEDULER_Task *shutdown_task;
-
-
/**
* Called to initialise the given RPSPeer
*/
* Append arguments to file
*/
static void
-tofile_ (const char *file_name, char *line)
+tofile_ (const char *file_name, const char *line)
{
struct GNUNET_DISK_FileHandle *f;
/* char output_buffer[512]; */
if (size != size2)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Unable to write to file! (Size: %u, size2: %u)\n",
+ "Unable to write to file! (Size: %lu, size2: %lu)\n",
size,
size2);
+ if (GNUNET_YES != GNUNET_DISK_file_close (f))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Unable to close file\n");
+ }
return;
}
if (GNUNET_YES != GNUNET_DISK_file_close (f))
+ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unable to close file\n");
+ }
}
/**
rps_peer_ids[entry->index] = *(pinfo->result.id);
rps_peers[entry->index].peer_id = &rps_peer_ids[entry->index];
- GNUNET_CONTAINER_multipeermap_put (peer_map,
- &rps_peer_ids[entry->index],
- &rps_peers[entry->index],
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multipeermap_put (peer_map,
+ &rps_peer_ids[entry->index],
+ &rps_peers[entry->index],
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
tofile ("/tmp/rps/peer_ids",
"%u\t%s\n",
entry->index,
if (0 == evaluate ())
{
- GNUNET_SCHEDULER_cancel (shutdown_task);
- shutdown_task = GNUNET_SCHEDULER_add_now (&shutdown_op, NULL);
+ GNUNET_SCHEDULER_shutdown ();
}
}
"%s\n",
GNUNET_i2s_full (&recv_peers[i]));
rcv_rps_peer = GNUNET_CONTAINER_multipeermap_get (peer_map, &recv_peers[i]);
+ GNUNET_assert (NULL != rcv_rps_peer);
tofile (file_name_dh,
"%" PRIu32 "\n",
(uint32_t) rcv_rps_peer->index);
{
RPS_sampler_elem_next (s_elem, &rps_peer_ids[i]);
}
+ RPS_sampler_elem_destroy (s_elem);
}
return GNUNET_OK;
}
if (NULL != churn_task)
GNUNET_SCHEDULER_cancel (churn_task);
- shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL);
+ GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL);
}