#include "gnunet_dht_service.h"
/* DEFINES */
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
/* Timeout for entire testcase */
#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
&put_finished, test_put);
test_put->disconnect_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
- &put_disconnect_task, test_put);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ &put_disconnect_task, test_put);
GNUNET_SCHEDULER_add_now (&do_put, test_put->next);
}
* The emsg variable is NULL on success (peers connected), and non-NULL on
* failure (peers failed to connect).
*/
-void
+static void
topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
const struct GNUNET_PeerIdentity *second, uint32_t distance,
const struct GNUNET_CONFIGURATION_Handle *first_cfg,
* @param d the daemon handle (pretty useless at this point, remove?)
* @param emsg non-null on failure
*/
-void
+static void
hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
struct GNUNET_TESTING_Daemon *d, const char *emsg)
{
* @param size number of bytes in data
* @param data pointer to the result data
*/
-void
+static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
const GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
}
-/**
- * Start the GET request for the same key/data that was inserted.
- */
-static void
-do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- GNUNET_HashCode key; /* Key for data lookup */
-
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
- global_get_handle =
- GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (),
- GNUNET_BLOCK_TYPE_TEST, &key,
- 1, GNUNET_DHT_RO_RECORD_ROUTE,
- NULL, 0, &get_result_iterator, NULL);
-}
/**
* Called when the PUT request has been transmitted to the DHT service.
static void
put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ GNUNET_HashCode key; /* Key for data lookup */
+
GNUNET_SCHEDULER_cancel (die_task);
die_task =
GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
"waiting for get response (data not found)");
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 10), &do_get, NULL);
+ memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
+ global_get_handle =
+ GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (),
+ GNUNET_BLOCK_TYPE_TEST, &key,
+ 1, GNUNET_DHT_RO_RECORD_ROUTE,
+ NULL, 0, &get_result_iterator, NULL);
}
/**
* The emsg variable is NULL on success (peers connected), and non-NULL on
* failure (peers failed to connect).
*/
-void
+static void
topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
const struct GNUNET_PeerIdentity *second, uint32_t distance,
const struct GNUNET_CONFIGURATION_Handle *first_cfg,