X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftestbed%2Fgnunet-service-testbed_cache.c;h=6a141a2525727dc75adebd2c92ce99b84c674dff;hb=2ca4b8a208f6f910c819bbaa6785a25ae2955501;hp=1022c0959383d22d90e00c80cd269e2e199211eb;hpb=11dc334be2fb942c65745b9605c619968655fdd5;p=oweals%2Fgnunet.git diff --git a/src/testbed/gnunet-service-testbed_cache.c b/src/testbed/gnunet-service-testbed_cache.c index 1022c0959..6a141a252 100644 --- a/src/testbed/gnunet-service-testbed_cache.c +++ b/src/testbed/gnunet-service-testbed_cache.c @@ -4,7 +4,7 @@ GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your + by the Free Software Foundation; either version 3, or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but @@ -607,11 +607,10 @@ oprelease_get_handle_transport (void *cls) * do this later). * * @param cls closure - * @param server handle to the server, NULL if we failed * @param my_identity ID of this peer, NULL if we failed */ static void -core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server, +core_startup_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) { struct CacheEntry *entry = cls; @@ -622,9 +621,8 @@ core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server, return; } GNUNET_assert (NULL == entry->peer_identity); - GNUNET_break (NULL != server); - entry->core_handle = server; - entry->peer_identity = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); + // FIXME: why is this dynamically allocated? + entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity); memcpy (entry->peer_identity, my_identity, sizeof (struct GNUNET_PeerIdentity)); if (0 == entry->demand) @@ -838,7 +836,8 @@ cache_clear_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) GNUNET_assert (NULL != entry); GNUNET_break (0 == entry->demand); LOG_DEBUG ("Clearing entry %u of %u\n", ++ncleared, cache_size); - GNUNET_CONTAINER_multihashmap_remove (cache, key, value); + GNUNET_assert (GNUNET_YES == + GNUNET_CONTAINER_multihashmap_remove (cache, key, value)); close_handles (entry); GNUNET_free_non_null (entry->hello); GNUNET_break (GNUNET_SCHEDULER_NO_TASK == entry->expire_task); @@ -933,9 +932,7 @@ GST_cache_get_handle_done (struct GSTCacheGetHandle *cgh) } else { - struct GSTCacheGetHandle *cgh2; - - if (NULL != (cgh2 = search_suitable_cgh (entry, entry->cgh_qhead))) + if (NULL != search_suitable_cgh (entry, entry->cgh_qhead)) entry->notify_task = GNUNET_SCHEDULER_add_now (&call_cgh_cb, entry); } }