diff options
Diffstat (limited to 'src/peerinfo-tool/gnunet-peerinfo.c')
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo.c | 17 |
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; | |||
39 | 39 | ||
40 | static struct GNUNET_SCHEDULER_Handle *sched; | 40 | static struct GNUNET_SCHEDULER_Handle *sched; |
41 | 41 | ||
42 | static struct GNUNET_PEERINFO_Handle *peerinfo; | ||
43 | |||
42 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 44 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
43 | 45 | ||
44 | struct PrintContext | 46 | struct PrintContext |
@@ -166,7 +168,10 @@ print_peer_info (void *cls, | |||
166 | struct PrintContext *pc; | 168 | struct PrintContext *pc; |
167 | 169 | ||
168 | if (peer == NULL) | 170 | if (peer == NULL) |
169 | return; | 171 | { |
172 | GNUNET_PEERINFO_disconnect (peerinfo); | ||
173 | return; | ||
174 | } | ||
170 | if (be_quiet) | 175 | if (be_quiet) |
171 | { | 176 | { |
172 | GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); | 177 | GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); |
@@ -212,8 +217,14 @@ run (void *cls, | |||
212 | cfg = c; | 217 | cfg = c; |
213 | if (get_self != GNUNET_YES) | 218 | if (get_self != GNUNET_YES) |
214 | { | 219 | { |
215 | (void) GNUNET_PEERINFO_iterate (cfg, | 220 | peerinfo = GNUNET_PEERINFO_connect (sched, cfg); |
216 | sched, | 221 | if (peerinfo == NULL) |
222 | { | ||
223 | fprintf (stderr, | ||
224 | _("Could not access PEERINFO service. Exiting.\n")); | ||
225 | return; | ||
226 | } | ||
227 | (void) GNUNET_PEERINFO_iterate (peerinfo, | ||
217 | NULL, | 228 | NULL, |
218 | 0, | 229 | 0, |
219 | GNUNET_TIME_relative_multiply | 230 | GNUNET_TIME_relative_multiply |