- * Stats callback. Finish the stats testbed operation and when all stats have
- * been iterated, shutdown the test.
- *
- * @param cls closure
- * @param op the operation that has been finished
- * @param emsg error message in case the operation has failed; will be NULL if
- * operation has executed successfully.
- */
-static void
-stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "stats_cont for peer %u\n", cls);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, " sent: %u, received: %u\n",
- ka_sent, ka_received);
- if (ka_sent < 2 || ka_sent > ka_received + 1)
- ok--;
- GNUNET_TESTBED_operation_done (stats_op);
-
- if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
- GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
- (void *) __LINE__);
-
-}
-
-
-/**
- * Process statistic values.
- *
- * @param cls closure
- * @param peer the peer the statistic belong to
- * @param subsystem name of subsystem that created the statistic
- * @param name the name of the datum
- * @param value the current value
- * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
- * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
- */
-static int
-stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
- const char *subsystem, const char *name,
- uint64_t value, int is_persistent)
-{
- static const char *s_sent = "# keepalives sent";
- static const char *s_recv = "# keepalives received";
- uint32_t i;
-
- i = GNUNET_TESTBED_get_index (peer);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u - %s [%s]: %llu\n",
- i, subsystem, name, value);
- if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
- ka_sent = value;
-
- if (0 == strncmp(s_recv, name, strlen (s_recv)) && 4 == i)
- ka_received = value;
-
- return GNUNET_OK;
-}
-
-
-/**
- * Task check that keepalives were sent and received.
- *
- * @param cls Closure (NULL).
- * @param tc Task Context.
- */
-static void
-check_keepalives (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
- return;
-
- disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n");
- GNUNET_CADET_channel_destroy (ch);
- stats_op = GNUNET_TESTBED_get_statistics (5, testbed_peers,
- "cadet", NULL,
- stats_iterator, stats_cont, NULL);
-}
-
-
-/**
- * Handlers, for diverse services