aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo-tool/gnunet-peerinfo.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-24 11:54:36 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-24 11:54:36 +0000
commiteafc8188ef6584f77dc4dbc6827210f384986e1a (patch)
tree501f87ddd224b0cbd5aaf9008b57005b129cac24 /src/peerinfo-tool/gnunet-peerinfo.c
parent2e95a6961bf57170b215ab28e50dbf2376d46747 (diff)
downloadgnunet-eafc8188ef6584f77dc4dbc6827210f384986e1a.tar.gz
gnunet-eafc8188ef6584f77dc4dbc6827210f384986e1a.zip
update peerinfo API to use MQ
Diffstat (limited to 'src/peerinfo-tool/gnunet-peerinfo.c')
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 5f28fd484..b6aa224fd 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -32,7 +32,7 @@
32#include "gnunet-peerinfo_plugins.h" 32#include "gnunet-peerinfo_plugins.h"
33 33
34/** 34/**
35 * How long until we time out during peerinfo iterations? 35 * How long until we time out during address lookup?
36 */ 36 */
37#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 37#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
38 38
@@ -210,7 +210,7 @@ static struct PrintContext *pc_tail;
210/** 210/**
211 * Handle to current #GNUNET_PEERINFO_add_peer() operation. 211 * Handle to current #GNUNET_PEERINFO_add_peer() operation.
212 */ 212 */
213static struct GNUNET_PEERINFO_AddContext *ac; 213static struct GNUNET_MQ_Envelope *ac;
214 214
215/** 215/**
216 * Hello of this peer (if initialized). 216 * Hello of this peer (if initialized).
@@ -561,17 +561,11 @@ print_my_uri (void *cls,
561 * Continuation called from #GNUNET_PEERINFO_add_peer() 561 * Continuation called from #GNUNET_PEERINFO_add_peer()
562 * 562 *
563 * @param cls closure, NULL 563 * @param cls closure, NULL
564 * @param emsg error message, NULL on success
565 */ 564 */
566static void 565static void
567add_continuation (void *cls, 566add_continuation (void *cls)
568 const char *emsg)
569{ 567{
570 ac = NULL; 568 ac = NULL;
571 if (NULL != emsg)
572 fprintf (stderr,
573 _("Failure adding HELLO: %s\n"),
574 emsg);
575 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL); 569 tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
576} 570}
577 571
@@ -599,7 +593,8 @@ parse_hello_uri (const char *put_uri)
599 { 593 {
600 /* WARNING: this adds the address from URI WITHOUT verification! */ 594 /* WARNING: this adds the address from URI WITHOUT verification! */
601 if (GNUNET_OK == ret) 595 if (GNUNET_OK == ret)
602 ac = GNUNET_PEERINFO_add_peer (peerinfo, hello, 596 ac = GNUNET_PEERINFO_add_peer (peerinfo,
597 hello,
603 &add_continuation, 598 &add_continuation,
604 NULL); 599 NULL);
605 else 600 else
@@ -628,7 +623,7 @@ shutdown_task (void *cls)
628 623
629 if (NULL != ac) 624 if (NULL != ac)
630 { 625 {
631 GNUNET_PEERINFO_add_peer_cancel (ac); 626 GNUNET_MQ_send_cancel (ac);
632 ac = NULL; 627 ac = NULL;
633 } 628 }
634 if (NULL != tt) 629 if (NULL != tt)
@@ -830,7 +825,6 @@ state_machine (void *cls)
830 pic = GNUNET_PEERINFO_iterate (peerinfo, 825 pic = GNUNET_PEERINFO_iterate (peerinfo,
831 include_friend_only, 826 include_friend_only,
832 NULL, 827 NULL,
833 TIMEOUT,
834 &print_peer_info, NULL); 828 &print_peer_info, NULL);
835 } 829 }
836 else if (GNUNET_YES == get_self) 830 else if (GNUNET_YES == get_self)
@@ -850,7 +844,6 @@ state_machine (void *cls)
850 pic = GNUNET_PEERINFO_iterate (peerinfo, 844 pic = GNUNET_PEERINFO_iterate (peerinfo,
851 include_friend_only, 845 include_friend_only,
852 &my_peer_identity, 846 &my_peer_identity,
853 TIMEOUT,
854 &print_my_uri, NULL); 847 &print_my_uri, NULL);
855 get_uri = GNUNET_NO; 848 get_uri = GNUNET_NO;
856 } 849 }