summaryrefslogtreecommitdiff
path: root/src/peerinfo-tool
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-04-21 20:19:43 +0000
committerChristian Grothoff <christian@grothoff.org>2010-04-21 20:19:43 +0000
commit84e15afe4933ee2ca62e3e111ca261c3a986c157 (patch)
tree8a9cd9a06b723b940f6d11b0272f5eb395db39c4 /src/peerinfo-tool
parenta06d7742d5a48229767c152f9466432d17e162de (diff)
activating new peerinfo API
Diffstat (limited to 'src/peerinfo-tool')
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 63c5cc008..5efd7262c 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -39,6 +39,8 @@ static int get_self;
static struct GNUNET_SCHEDULER_Handle *sched;
+static struct GNUNET_PEERINFO_Handle *peerinfo;
+
static const struct GNUNET_CONFIGURATION_Handle *cfg;
struct PrintContext
@@ -166,7 +168,10 @@ print_peer_info (void *cls,
struct PrintContext *pc;
if (peer == NULL)
- return;
+ {
+ GNUNET_PEERINFO_disconnect (peerinfo);
+ return;
+ }
if (be_quiet)
{
GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
@@ -212,8 +217,14 @@ run (void *cls,
cfg = c;
if (get_self != GNUNET_YES)
{
- (void) GNUNET_PEERINFO_iterate (cfg,
- sched,
+ peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
+ if (peerinfo == NULL)
+ {
+ fprintf (stderr,
+ _("Could not access PEERINFO service. Exiting.\n"));
+ return;
+ }
+ (void) GNUNET_PEERINFO_iterate (peerinfo,
NULL,
0,
GNUNET_TIME_relative_multiply