aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-08-03 09:29:08 +0000
committerChristian Grothoff <christian@grothoff.org>2015-08-03 09:29:08 +0000
commitf5e0004a8edd5c1961eec2aefc3cd51595b62cf1 (patch)
tree40437580acc8d7186adc986153a6fbf22736bf35 /src/dht
parent714aa2df003c8baa8826131f0fba0eed44029b2d (diff)
downloadgnunet-f5e0004a8edd5c1961eec2aefc3cd51595b62cf1.tar.gz
gnunet-f5e0004a8edd5c1961eec2aefc3cd51595b62cf1.zip
-use simpler, modern scheduler API
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/test_dht_api.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index a78e93504..58b3e0b26 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009 Christian Grothoff (and other contributing authors) 3 Copyright (C) 2009, 2015 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -22,7 +22,6 @@
22 * @brief base test case for dht api 22 * @brief base test case for dht api
23 * 23 *
24 * This test case tests DHT api to DUMMY DHT service communication. 24 * This test case tests DHT api to DUMMY DHT service communication.
25 *
26 */ 25 */
27#include "platform.h" 26#include "platform.h"
28#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
@@ -120,17 +119,12 @@ end_badly ()
120 * @param tc context information (why was this task triggered now) 119 * @param tc context information (why was this task triggered now)
121 */ 120 */
122static void 121static void
123test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 122test_get_stop (void *cls,
123 const struct GNUNET_SCHEDULER_TaskContext *tc)
124{ 124{
125 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get_stop!\n"); 125 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
126 if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) 126 "Called test_get_stop!\n");
127 { 127 GNUNET_assert (NULL != dht_handle);
128 GNUNET_break (0);
129 GNUNET_SCHEDULER_cancel (die_task);
130 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
131 return;
132 }
133 GNUNET_assert (dht_handle != NULL);
134 GNUNET_DHT_get_stop (get_handle); 128 GNUNET_DHT_get_stop (get_handle);
135 get_handle = NULL; 129 get_handle = NULL;
136 GNUNET_SCHEDULER_add_now (&end, NULL); 130 GNUNET_SCHEDULER_add_now (&end, NULL);
@@ -143,13 +137,14 @@ test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
143 const struct GNUNET_PeerIdentity *get_path, 137 const struct GNUNET_PeerIdentity *get_path,
144 unsigned int get_path_length, 138 unsigned int get_path_length,
145 const struct GNUNET_PeerIdentity *put_path, 139 const struct GNUNET_PeerIdentity *put_path,
146 unsigned int put_path_length, enum GNUNET_BLOCK_Type type, 140 unsigned int put_path_length,
141 enum GNUNET_BLOCK_Type type,
147 size_t size, const void *data) 142 size_t size, const void *data)
148{ 143{
149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 144 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
150 "test_get_iterator called (we got a result), stopping get request!\n"); 145 "test_get_iterator called (we got a result), stopping get request!\n");
151 GNUNET_SCHEDULER_add_continuation (&test_get_stop, NULL, 146 GNUNET_SCHEDULER_add_now (&test_get_stop,
152 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 147 NULL);
153} 148}
154 149
155 150
@@ -164,9 +159,12 @@ test_get (void *cls, int success)
164{ 159{
165 struct GNUNET_HashCode hash; 160 struct GNUNET_HashCode hash;
166 161
167 memset (&hash, 42, sizeof (struct GNUNET_HashCode)); 162 memset (&hash,
163 42,
164 sizeof (struct GNUNET_HashCode));
168 165
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get!\n"); 166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
167 "Called test_get!\n");
170 GNUNET_assert (dht_handle != NULL); 168 GNUNET_assert (dht_handle != NULL);
171 retry_context.real_timeout = GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT); 169 retry_context.real_timeout = GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT);
172 retry_context.next_timeout = BASE_TIMEOUT; 170 retry_context.next_timeout = BASE_TIMEOUT;