From 320460014899596bd93f17cd8e968b393e8e5a85 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?utf8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Sat, 25 Feb 2017 12:56:57 +0000 Subject: [PATCH] W32: port gnunet-gns-import to new zone iterator callback API --- src/gns/gnunet-gns-import.c | 71 ++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c index e98babfa8..49f6e495f 100644 --- a/src/gns/gnunet-gns-import.c +++ b/src/gns/gnunet-gns-import.c @@ -224,45 +224,52 @@ zone_iterator (void *cls, else if (0 == strcmp (rname, "pin")) check_pkey (rd_len, rd, pin_zone_pkey, &found_pin_rec); } - if (NULL == rname && 0 == rd_len && NULL == rd) + GNUNET_NAMESTORE_zone_iterator_next (list_it); +} + +static void +zone_iteration_error (void *cls) +{ + enum GNUNET_OS_ProcessStatusType st; + unsigned long code; + if (!found_private_rec) { - enum GNUNET_OS_ProcessStatusType st; - unsigned long code; - if (!found_private_rec) + if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, + "gnunet-namestore", + "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "private", "-p", "-t", "PKEY", "-V", private_zone_pkey, NULL)) { - if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, - "gnunet-namestore", - "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "private", "-p", "-t", "PKEY", "-V", private_zone_pkey, NULL)) - { - ret = 8; - return; - } + ret = 8; + return; } - if (!found_short_rec) + } + if (!found_short_rec) + { + if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, + "gnunet-namestore", + "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "short", "-p", "-t", "PKEY", "-V", short_zone_pkey, NULL)) { - if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, - "gnunet-namestore", - "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "short", "-p", "-t", "PKEY", "-V", short_zone_pkey, NULL)) - { - ret = 9; - return; - } + ret = 9; + return; } - if (!found_pin_rec) + } + if (!found_pin_rec) + { + if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, + "gnunet-namestore", + "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "pin", "-p", "-t", "PKEY", "-V", pin_zone_pkey, NULL)) { - if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, - "gnunet-namestore", - "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "pin", "-p", "-t", "PKEY", "-V", pin_zone_pkey, NULL)) - { - ret = 10; - return; - } + ret = 10; + return; } - list_it = NULL; - GNUNET_SCHEDULER_shutdown (); - return; } - GNUNET_NAMESTORE_zone_iterator_next (list_it); + list_it = NULL; + GNUNET_SCHEDULER_shutdown (); +} + + +static void +zone_iteration_finished (void *cls) +{ } @@ -317,7 +324,7 @@ get_ego (void *cls, return; } list_it = GNUNET_NAMESTORE_zone_iteration_start (ns, - &master_pk, &zone_iterator, NULL); + &master_pk, &zone_iteration_error, NULL, &zone_iterator, NULL, &zone_iteration_finished, NULL); if (NULL == list_it) { ret = 12; -- 2.25.1