/*
This file is part of GNUnet.
- (C) 2012 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2012 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
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 namecache/test_namecache_api.c
static struct GNUNET_NAMECACHE_Handle *nsh;
-static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
+static struct GNUNET_SCHEDULER_Task * endbadly_task;
static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
GNUNET_assert (NULL != cls);
- if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
+ if (endbadly_task != NULL)
{
GNUNET_SCHEDULER_cancel (endbadly_task);
- endbadly_task = GNUNET_SCHEDULER_NO_TASK;
+ endbadly_task = NULL;
}
if (NULL == block)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Namecache returned no block\n"));
- if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
+ if (endbadly_task != NULL)
GNUNET_SCHEDULER_cancel (endbadly_task);
endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
return;
GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey);
- rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
+ rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 10000000000;
rd.record_type = TEST_RECORD_TYPE;
rd.data_size = TEST_RECORD_DATALEN;
rd.data = GNUNET_malloc (TEST_RECORD_DATALEN);
+ rd.flags = 0;
memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN);
block = GNUNET_GNSRECORD_block_create (privkey,
- GNUNET_TIME_UNIT_FOREVER_ABS, name, &rd, 1 );
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ name, &rd, 1);
if (NULL == block)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Namecache cannot cache no block\n"));
+ "Namecache cannot cache no block!\n");
+ GNUNET_SCHEDULER_shutdown ();
+ GNUNET_free (block);
+ return;
}
nsh = GNUNET_NAMECACHE_connect (cfg);
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Namecache cannot connect to namecache\n"));
+ GNUNET_SCHEDULER_shutdown ();
+ GNUNET_free (block);
+ return;
}
GNUNET_break (NULL != nsh);
- nsqe = GNUNET_NAMECACHE_block_cache (nsh, block , &cache_cont, (void *) name);
+ nsqe = GNUNET_NAMECACHE_block_cache (nsh,
+ block,
+ &cache_cont, (void *) name);
if (NULL == nsqe)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Namecache cannot cache no block\n"));
}
-
+ GNUNET_free (block);
GNUNET_free ((void *)rd.data);
}