X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fnamestore%2Ftest_namestore_api_store.c;h=d80676770180898c6bf0fd0955d136c19e5f3b1a;hb=284cfac7a521ad275b7536ce1075f62b6e45ea44;hp=85c4a280606fcb56e1c931103792357cabc7c44a;hpb=56f3001a4d745dfa5ad196c1b18c672145c89f4c;p=oweals%2Fgnunet.git diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 85c4a2806..d80676770 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2012 Christian Grothoff (and other contributing authors) + Copyright (C) 2012 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,8 +14,8 @@ 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 namestore/test_namestore_api_store.c @@ -36,7 +36,7 @@ static struct GNUNET_NAMESTORE_Handle *nsh; -static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; +static struct GNUNET_SCHEDULER_Task * endbadly_task; static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; @@ -46,6 +46,7 @@ static int res; static struct GNUNET_NAMESTORE_QueueEntry *nsqe; +static char *directory; static void cleanup () @@ -68,10 +69,9 @@ cleanup () * Re-establish the connection to the service. * * @param cls handle to use to re-connect. - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { if (NULL != nsqe) { @@ -84,7 +84,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void -end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end (void *cls) { cleanup (); res = 0; @@ -103,7 +103,7 @@ put_cont (void *cls, int32_t success, const char *emsg) name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_NO_TASK; + endbadly_task = NULL; GNUNET_SCHEDULER_add_now (&end, NULL); } @@ -117,6 +117,11 @@ run (void *cls, char *hostkey_file; const char * name = "dummy.dummy.gnunet"; + directory = NULL; + GNUNET_assert (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory)); + GNUNET_DISK_directory_remove (directory); + endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL); GNUNET_asprintf (&hostkey_file, @@ -160,7 +165,14 @@ main (int argc, char *argv[]) "test_namestore_api.conf", &run, NULL)) - return 1; + { + res = 1; + } + if (NULL != directory) + { + GNUNET_DISK_directory_remove (directory); + GNUNET_free (directory); + } return res; }