*/
struct GNUNET_TIME_Relative hello_expiration;
+/**
+ * Should we store our topology predecessor and successor IDs into statistics?
+ */
+extern unsigned int track_topology;
+
#if ENABLE_MALICIOUS
/**
* Should this peer act malicious?
run (void *cls, struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ unsigned long long _track_topology;
GDS_cfg = c;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION", &hello_expiration))
}
GDS_block_context = GNUNET_BLOCK_context_create (GDS_cfg);
GDS_stats = GNUNET_STATISTICS_create ("dht", GDS_cfg);
-
GDS_ROUTING_init ();
GDS_NSE_init ();
GDS_DATACACHE_init ();
GDS_HELLO_init ();
GDS_CLIENTS_init (server);
-
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (c, "xdht", "track_toplogy",
+ &_track_topology))
+ {
+ track_topology = (unsigned int) _track_topology;
+ }
if (GNUNET_OK != GDS_NEIGHBOURS_init ())
{
shutdown_task (NULL, NULL);
*/
static struct GNUNET_CORE_Handle *core_api;
+/**
+ * Handle for the statistics service.
+ */
+extern struct GNUNET_STATISTICS_Handle *GDS_stats;
+
/**
* The current finger index that we have want to find trail to. We start the
* search with value = 0, i.e. successor and then go to PREDCESSOR_FINGER_ID
*/
static unsigned int current_search_finger_index;
+/**
+ * Should we store our topology predecessor and successor IDs into statistics?
+ */
+unsigned int track_topology;
+
/**
* Called when core is ready to send a message we asked for
GDS_ROUTING_SRC_TO_DEST,
finger_identity);
}
+ /* Store the successor for path tracking */
+ if (track_topology && (NULL != GDS_stats) && (0 == finger_table_index))
+ {
+ char *my_id_str;
+ char *succ_id_str;
+ char *key;
+
+ my_id_str = GNUNET_strdup (GNUNET_i2s (&my_identity));
+ succ_id_str = GNUNET_strdup (GNUNET_i2s
+ (&existing_finger->finger_identity));
+ GNUNET_asprintf (&key, "XDHT:0:%.4s:%.4s", my_id_str, succ_id_str);
+ GNUNET_free (my_id_str);
+ GNUNET_free (succ_id_str);
+ GNUNET_STATISTICS_update (GDS_stats, "key", 1, 0);
+ GNUNET_free (key);
+ }
}
}
else
return my_identity;
}
-/* end of gnunet-service-xdht_neighbours.c */
\ No newline at end of file
+/* end of gnunet-service-xdht_neighbours.c */