X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fpeerstore%2Ftest_peerstore_api_store.c;h=bfe1b5b55dfb362616e0ef8e3f83c94465f9ccde;hb=14848b88f7b0d6f0f35ae8d89304062a96fe03cc;hp=794a2b04867e9da412d9e8e37d59306d1e767fa6;hpb=fb12af8319a84389a536ab2f3735daf3b24f11bd;p=oweals%2Fgnunet.git diff --git a/src/peerstore/test_peerstore_api_store.c b/src/peerstore/test_peerstore_api_store.c index 794a2b048..bfe1b5b55 100644 --- a/src/peerstore/test_peerstore_api_store.c +++ b/src/peerstore/test_peerstore_api_store.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) + Copyright (C) GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,17 +14,17 @@ You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** * @file peerstore/test_peerstore_api_store.c * @brief testcase for peerstore store operation */ #include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testing_lib.h" #include "gnunet_peerstore_service.h" +#include "gnunet_testing_lib.h" + static int ok = 1; @@ -39,25 +39,24 @@ static char *val3 = "test_peerstore_api_store_val3--"; static int count = 0; -static int +static void test3_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) { if (NULL != emsg) - return GNUNET_NO; + return; if (NULL != record) { GNUNET_assert ((strlen (val3) + 1) == record->value_size); GNUNET_assert (0 == strcmp ((char *) val3, (char *) record->value)); count++; - return GNUNET_YES; + return; } GNUNET_assert (count == 1); ok = 0; GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); GNUNET_SCHEDULER_shutdown (); - return GNUNET_YES; } @@ -67,7 +66,11 @@ test3_cont (void *cls, int success) if (GNUNET_YES != success) return; count = 0; - GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, GNUNET_TIME_UNIT_SECONDS, + GNUNET_PEERSTORE_iterate (h, + subsystem, + &pid, + key, + GNUNET_TIME_UNIT_SECONDS, &test3_cont2, NULL); } @@ -85,13 +88,13 @@ test3 () } -static int +static void test2_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) { if (NULL != emsg) - return GNUNET_NO; + return; if (NULL != record) { GNUNET_assert (((strlen (val1) + 1) == record->value_size) || @@ -99,12 +102,11 @@ test2_cont2 (void *cls, GNUNET_assert ((0 == strcmp ((char *) val1, (char *) record->value)) || (0 == strcmp ((char *) val2, (char *) record->value))); count++; - return GNUNET_YES; + return; } GNUNET_assert (count == 2); count = 0; test3 (); - return GNUNET_YES; } @@ -114,7 +116,10 @@ test2_cont (void *cls, int success) if (GNUNET_YES != success) return; count = 0; - GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, GNUNET_TIME_UNIT_SECONDS, + GNUNET_PEERSTORE_iterate (h, + subsystem, + &pid, key, + GNUNET_TIME_UNIT_SECONDS, &test2_cont2, NULL); } @@ -132,24 +137,23 @@ test2 () } -static int +static void test1_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) { if (NULL != emsg) - return GNUNET_NO; + return; if (NULL != record) { GNUNET_assert ((strlen (val1) + 1) == record->value_size); GNUNET_assert (0 == strcmp ((char *) val1, (char *) record->value)); count++; - return GNUNET_YES; + return; } GNUNET_assert (count == 1); count = 0; test2 (); - return GNUNET_YES; } @@ -178,8 +182,7 @@ test1 () static void -run (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg, +run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { h = GNUNET_PEERSTORE_connect (cfg);