[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34043 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34043 - gnunet/src/dht |
Date: |
Thu, 24 Jul 2014 17:18:37 +0200 |
Author: harsha
Date: 2014-07-24 17:18:37 +0200 (Thu, 24 Jul 2014)
New Revision: 34043
Modified:
gnunet/src/dht/gnunet-service-xdht.c
gnunet/src/dht/gnunet-service-xdht_neighbours.c
Log:
xdht: track topology successor and predecessor neighbours.
Modified: gnunet/src/dht/gnunet-service-xdht.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht.c 2014-07-24 14:27:25 UTC (rev
34042)
+++ gnunet/src/dht/gnunet-service-xdht.c 2014-07-24 15:18:37 UTC (rev
34043)
@@ -77,6 +77,11 @@
*/
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?
@@ -153,6 +158,7 @@
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))
@@ -161,13 +167,17 @@
}
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);
Modified: gnunet/src/dht/gnunet-service-xdht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_neighbours.c 2014-07-24 14:27:25 UTC
(rev 34042)
+++ gnunet/src/dht/gnunet-service-xdht_neighbours.c 2014-07-24 15:18:37 UTC
(rev 34043)
@@ -860,6 +860,11 @@
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
* and decrement it. For any index 63 <= index < 0, if finger is same as
successor,
@@ -867,7 +872,12 @@
*/
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
* out to the destination.
@@ -3386,6 +3396,22 @@
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
@@ -5653,4 +5679,4 @@
return my_identity;
}
-/* end of gnunet-service-xdht_neighbours.c */
\ No newline at end of file
+/* end of gnunet-service-xdht_neighbours.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34043 - gnunet/src/dht,
gnunet <=