summaryrefslogtreecommitdiff
path: root/src/peerinfo-tool
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-04-23 09:46:25 +0000
committerChristian Grothoff <christian@grothoff.org>2010-04-23 09:46:25 +0000
commitb03c1fcb8458283526af2ef15f8dab7edf7c14f8 (patch)
tree3d87a7670c1fa32bfeb334ad5ce194e68d6309d5 /src/peerinfo-tool
parent597e676a39da448348164042bb0e0b1f9b957c40 (diff)
peerinfo
Diffstat (limited to 'src/peerinfo-tool')
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c24
-rwxr-xr-xsrc/peerinfo-tool/test_gnunet_peerinfo.py16
2 files changed, 40 insertions, 0 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index ba6609596..ba9832099 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -228,9 +228,33 @@ run (void *cls,
struct GNUNET_PeerIdentity pid;
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
char *fn;
+ int delta;
sched = s;
cfg = c;
+ delta = 0;
+ if ( (args[0] != NULL) &&
+ (args[1] != NULL) &&
+ (1 == sscanf(args[0], "%d", &delta)) &&
+ (GNUNET_OK ==
+ GNUNET_CRYPTO_hash_from_string (args[1],
+ &pid.hashPubKey)) )
+ {
+ peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
+ GNUNET_PEERINFO_iterate (peerinfo,
+ &pid,
+ delta,
+ GNUNET_TIME_UNIT_SECONDS,
+ &print_peer_info, NULL);
+ return;
+ }
+ else if (args[0] != NULL)
+ {
+ fprintf (stderr,
+ _("Invalid command line argument `%s'\n"),
+ args[0]);
+ return;
+ }
if (get_self != GNUNET_YES)
{
peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py b/src/peerinfo-tool/test_gnunet_peerinfo.py
index 3aa8497af..e9881a7b6 100755
--- a/src/peerinfo-tool/test_gnunet_peerinfo.py
+++ b/src/peerinfo-tool/test_gnunet_peerinfo.py
@@ -38,6 +38,11 @@ try:
pinfo.expect (re.compile (".......................................................................................................\r"));
pinfo.expect (pexpect.EOF);
+ pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf invalid')
+ pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r"));
+ pinfo.expect (pexpect.EOF);
+
+
os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf')
pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf')
@@ -50,6 +55,17 @@ try:
pinfo.expect (re.compile (" *127.0.0.1:24357\r"));
pinfo.expect (pexpect.EOF);
+ pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs')
+ pid = pinfo.read (-1)
+ pid = pid.strip ()
+
+ pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 ' + pid)
+ pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *4\r"));
+ pinfo.expect (pexpect.EOF);
+
+ pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- -4 ' + pid)
+ pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *0\r"));
+ pinfo.expect (pexpect.EOF);
finally:
os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq')