#include "gnunet_dht_service.h"
/* DEFINES */
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
/* Timeout for entire testcase */
#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
struct TestPutContext
{
- /* This is a linked list */
+ /**
+ * This is a linked list
+ */
struct TestPutContext *next;
/**
if (test_get->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel(sched, test_get->disconnect_task);
if (test_get->get_handle != NULL)
- GNUNET_DHT_get_stop(test_get->get_handle, NULL, NULL);
+ GNUNET_DHT_get_stop(test_get->get_handle);
if (test_get->dht_handle != NULL)
GNUNET_DHT_disconnect(test_get->dht_handle);
test_get = test_get->next;
if (test_get->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel(sched, test_get->disconnect_task);
if (test_get->get_handle != NULL)
- GNUNET_DHT_get_stop(test_get->get_handle, NULL, NULL);
+ GNUNET_DHT_get_stop(test_get->get_handle);
if (test_get->dht_handle != NULL)
GNUNET_DHT_disconnect(test_get->dht_handle);
test_get = test_get->next;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get from peer %s for key %s failed!\n", test_get->daemon->shortname, GNUNET_h2s(&search_key));
}
GNUNET_assert(test_get->get_handle != NULL);
- GNUNET_DHT_get_stop(test_get->get_handle, &get_stop_finished, test_get);
+ GNUNET_DHT_get_stop(test_get->get_handle);
+ GNUNET_SCHEDULER_add_now (sched, &get_stop_finished, test_get);
test_get->get_handle = NULL;
test_get->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
void get_result_iterator (void *cls,
struct GNUNET_TIME_Absolute exp,
const GNUNET_HashCode * key,
- uint32_t type,
- uint32_t size,
+ const struct GNUNET_PeerIdentity * const *get_path,
+ const struct GNUNET_PeerIdentity * const *put_path,
+ enum GNUNET_BLOCK_Type type,
+ size_t size,
const void *data)
{
struct TestGetContext *test_get = cls;
GNUNET_SCHEDULER_add_continuation(sched, &get_stop_task, test_get, GNUNET_SCHEDULER_REASON_PREREQ_DONE);
}
-/**
- * Continuation telling us GET request was sent.
- */
-static void
-get_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
-{
- // Is there something to be done here?
- if (tc->reason != GNUNET_SCHEDULER_REASON_PREREQ_DONE)
- return;
-}
/**
* Set up some data, and call API PUT function
GNUNET_assert(test_get->dht_handle != NULL);
outstanding_gets++;
test_get->get_handle = GNUNET_DHT_get_start(test_get->dht_handle,
- GNUNET_TIME_relative_get_forever(),
- 1,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_BLOCK_TYPE_TEST,
&key,
+ GNUNET_DHT_RO_NONE,
+ NULL, 0,
+ NULL, 0,
&get_result_iterator,
- test_get,
- &get_continuation,
test_get);
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting get for uid %u from peer %s\n",
outstanding_puts++;
GNUNET_DHT_put(test_put->dht_handle,
&key,
- 1,
+ GNUNET_DHT_RO_NONE,
+ GNUNET_BLOCK_TYPE_TEST,
sizeof(data), data,
- GNUNET_TIME_absolute_get_forever(),
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_TIME_UNIT_FOREVER_REL,
&put_finished, test_put);
test_put->disconnect_task = GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_get_forever(), &put_disconnect_task, test_put);
GNUNET_SCHEDULER_add_now(sched, &do_put, test_put->next);