[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: add method to record and pr
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: add method to record and print DHT routes to DHT command-line tools |
Date: |
Tue, 31 Jan 2017 14:44:29 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 2503d0fdf add method to record and print DHT routes to DHT
command-line tools
2503d0fdf is described below
commit 2503d0fdf24b506999ed927240c55d3863e6163c
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Jan 31 14:44:41 2017 +0100
add method to record and print DHT routes to DHT command-line tools
---
src/dht/gnunet-dht-get.c | 31 +++++++++++++++++++++++++++----
src/dht/gnunet-dht-put.c | 18 ++++++++++++++++--
2 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 8a1b836f6..ce479dc3e 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -148,13 +148,36 @@ get_result_iterator (void *cls, struct
GNUNET_TIME_Absolute exp,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
- unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
- size_t size, const void *data)
+ unsigned int put_path_length,
+ enum GNUNET_BLOCK_Type type,
+ size_t size,
+ const void *data)
{
FPRINTF (stdout,
_("Result %d, type %d:\n%.*s\n"),
- result_count, type,
- (unsigned int) size, (char *) data);
+ result_count,
+ type,
+ (unsigned int) size,
+ (char *) data);
+ if (verbose)
+ {
+ FPRINTF (stdout,
+ " GET path: ");
+ for (unsigned int i=0;i<get_path_length;i++)
+ FPRINTF (stdout,
+ "%s%s",
+ (0 == i) ? "" : "-",
+ GNUNET_i2s (&get_path[i]));
+ FPRINTF (stdout,
+ "\n PUT path: ");
+ for (unsigned int i=0;i<put_path_length;i++)
+ FPRINTF (stdout,
+ "%s%s",
+ (0 == i) ? "" : "-",
+ GNUNET_i2s (&put_path[i]));
+ FPRINTF (stdout,
+ "\n");
+ }
result_count++;
}
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 1f3df1d35..9b17da01f 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -57,11 +57,16 @@ static unsigned int replication = 5;
static int verbose;
/**
- * Use DHT demultixplex_everywhere
+ * Use #GNUNET_DHT_DEMULTIPLEX_EVERYWHERE.
*/
static int demultixplex_everywhere;
/**
+ * Use #GNUNET_DHT_RO_RECORD_ROUTE.
+ */
+static int record_route;
+
+/**
* Handle to the DHT
*/
static struct GNUNET_DHT_Handle *dht_handle;
@@ -144,6 +149,7 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c)
{
struct GNUNET_TIME_Absolute expiration;
+ enum GNUNET_DHT_RouteOption ro;
cfg = c;
if ((NULL == query_key) || (NULL == data))
@@ -171,10 +177,15 @@ run (void *cls,
if (verbose)
FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"),
query_key, data);
+ ro = GNUNET_DHT_RO_NONE;
+ if (demultixplex_everywhere)
+ ro |= GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
+ if (record_route)
+ ro |= GNUNET_DHT_RO_RECORD_ROUTE;
GNUNET_DHT_put (dht_handle,
&key,
replication,
- (demultixplex_everywhere) ?
GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE : GNUNET_DHT_RO_NONE,
+ ro,
query_type,
strlen (data),
data,
@@ -203,6 +214,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
{'r', "replication", "LEVEL",
gettext_noop ("how many replicas to create"),
1, &GNUNET_GETOPT_set_uint, &replication},
+ {'R', "record", NULL,
+ gettext_noop ("use DHT's record route option"),
+ 0, &GNUNET_GETOPT_set_one, &record_route},
{'t', "type", "TYPE",
gettext_noop ("the type to insert data as"),
1, &GNUNET_GETOPT_set_uint, &query_type},
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: add method to record and print DHT routes to DHT command-line tools,
gnunet <=