- synchronous/asynchronous API (& implementation) is not nice;
=> provide notification-based API
- does not seem to work with timeouts (especially if service is not running)
- - add stats to peerinfo (# peers tracked)
- add stats to fs service (# queries, # replies, # routed, # found, # pending)
- add stats to dvstore (# bytes available, # bytes used, # PUTs, # GETs, # GETs satisfied)
* ARM:
gnunet-service-peerinfo.c
gnunet_service_peerinfo_LDADD = \
$(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_service_lib.h"
+#include "gnunet_statistics_service.h"
#include "peerinfo.h"
/**
*/
static char *trustDirectory;
+/**
+ * Handle for reporting statistics.
+ */
+static struct GNUNET_STATISTICS_Handle *stats;
+
/**
* Notify all clients in the notify list about the
entry = lookup_host_entry (identity);
if (entry != NULL)
return;
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# peers known"),
+ 1,
+ GNUNET_NO);
entry = GNUNET_malloc (sizeof (struct HostEntry));
entry->identity = *identity;
fn = get_trust_filename (identity);
{
GNUNET_SERVER_notification_context_destroy (notify_list);
notify_list = NULL;
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+ stats = NULL;
+ }
}
struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ stats = GNUNET_STATISTICS_create (sched, "statistics", cfg);
notify_list = GNUNET_SERVER_notification_context_create (server, 0);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_filename (cfg,