#include "gnunet_dht_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_gns_service.h"
+#include "gnunet_statistics_service.h"
#include "block_gns.h"
#include "gns.h"
#include "gnunet-service-gns_resolver.h"
/* Shorten DLL for cancelling NS requests */
static struct ClientShortenHandle *csh_tail;
+/* Statistics handle */
+static struct GNUNET_STATISTICS_Handle *statistics;
+
/**
* Send shorten response back to client
*
zone_update_taskid = GNUNET_SCHEDULER_add_delayed (dht_max_update_interval,
&update_zone_dht_start,
NULL);
+ GNUNET_STATISTICS_update (statistics,
+ "Number of zone iterations", 1, GNUNET_NO);
return;
}
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"DHT req to %d\n", DHT_OPERATION_TIMEOUT.rel_value);
+
+ GNUNET_STATISTICS_update (statistics,
+ "Record data set put into DHT", 1, GNUNET_NO);
+
/* FIXME: keep return value to possibly cancel? */
GNUNET_DHT_put (dht_handle, &xor_hash,
DHT_GNS_REPLICATION_LEVEL,
1);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"No records in db. Adjusted record put interval to 1s\n");
+ GNUNET_STATISTICS_set (statistics,
+ "Current PUT interval (sec)", 1,
+ GNUNET_NO);
}
else
{
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"Adjusted DHT update interval to %ds!\n",
interval);
+ GNUNET_STATISTICS_set (statistics,
+ "Current PUT interval (sec)", interval,
+ GNUNET_NO);
}
/* start counting again */
name = "";
}
+ GNUNET_STATISTICS_update (statistics,
+ "Name shorten results", 1, GNUNET_NO);
+
rmsg = GNUNET_malloc(sizeof(struct GNUNET_GNS_ClientShortenResultMessage)
+ strlen(name) + 1);
csh->root_zone = sh_msg->zone;
start_shorten_name (csh);
+
+ GNUNET_STATISTICS_update (statistics,
+ "Name shorten attempts", 1, GNUNET_NO);
}
struct GNUNET_GNS_ClientGetAuthResultMessage *rmsg;
struct ClientGetAuthHandle *cah = (struct ClientGetAuthHandle *)cls;
+ if (name != NULL)
+ {
+ GNUNET_STATISTICS_update (statistics,
+ "Authorities resolved", 1, GNUNET_NO);
+ }
+
if (name == NULL)
{
name = "";
GNUNET_NO);
GNUNET_SERVER_receive_done (cah->client, GNUNET_OK);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up handles...\n");
-
GNUNET_free(rmsg);
GNUNET_free_non_null(cah->name);
GNUNET_free(cah);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "done.\n");
-
+
+
}
/* Start delegation resolution in our namestore */
gns_resolver_get_authority(zone_hash, zone_hash, name, &send_get_auth_response, cah);
+
+ GNUNET_STATISTICS_update (statistics,
+ "Authority lookup attempts", 1, GNUNET_NO);
}
GNUNET_free(clh);
+ GNUNET_STATISTICS_update (statistics,
+ "Completed lookups", 1, GNUNET_NO);
+
+ if (rd != NULL)
+ {
+ GNUNET_STATISTICS_update (statistics,
+ "Records resolved", rd_count, GNUNET_NO);
+ }
+
}
only_cached,
&send_lookup_response, clh);
}
+
+ GNUNET_STATISTICS_update (statistics,
+ "Record lookup attempts", 1, GNUNET_NO);
}
/**
// &client_disconnect_notification,
// NULL);
+ statistics = GNUNET_STATISTICS_create ("gns", c);
+
nc = GNUNET_SERVER_notification_context_create (server, 1);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,