}
+static void
+destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx)
+{
+ struct GNUNET_CONSENSUS_Handle *consensus;
+ consensus = cls;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "destroying consensus\n");
+ GNUNET_CONSENSUS_destroy (consensus);
+}
+
+
/**
* Called when a conclusion was successful.
*
* @param group
* @return GNUNET_YES if more consensus groups should be offered, GNUNET_NO if not
*/
-static int
+static void
conclude_cb (void *cls, const struct GNUNET_CONSENSUS_Group *group)
{
- return GNUNET_NO;
+ GNUNET_SCHEDULER_add_now (destroy, cls);
}
-
static void
generate_indices (int *indices)
{
new_element_cb (void *cls,
struct GNUNET_CONSENSUS_Element *element)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "received new element\n");
return GNUNET_YES;
}
int i;
+ GNUNET_log_setup ("gnunet-consensus", "INFO", NULL);
+
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "test master\n");
+
peers = started_peers;
peer_ids = GNUNET_malloc (num_peers * sizeof (struct GNUNET_PeerIdentity));
{
static char *session_str = "gnunet-consensus/test";
+ if (num_peers < replication)
+ {
+ fprintf (stderr, "k must be <=n\n");
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "running gnunet-consensus\n");