aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_twopeer_put_get.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-02 14:14:53 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-02 14:14:53 +0000
commit4ac2347bb68f272caee9a243863fcaec483ed2dc (patch)
treef9b482697212265713797e94dfe19df989a697a0 /src/dht/test_dht_twopeer_put_get.c
parent18954ad8a33e9beda70e9b8ce122b2cf2756056d (diff)
downloadgnunet-4ac2347bb68f272caee9a243863fcaec483ed2dc.tar.gz
gnunet-4ac2347bb68f272caee9a243863fcaec483ed2dc.zip
make third test compile
Diffstat (limited to 'src/dht/test_dht_twopeer_put_get.c')
-rw-r--r--src/dht/test_dht_twopeer_put_get.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/dht/test_dht_twopeer_put_get.c b/src/dht/test_dht_twopeer_put_get.c
index f750ca78e..16a184e92 100644
--- a/src/dht/test_dht_twopeer_put_get.c
+++ b/src/dht/test_dht_twopeer_put_get.c
@@ -186,14 +186,11 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
186{ 186{
187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n", (char *)cls); 187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n", (char *)cls);
188 if (global_get_handle != NULL) 188 if (global_get_handle != NULL)
189 { 189 {
190 GNUNET_DHT_get_stop(global_get_handle, &end_badly_cont, NULL); 190 GNUNET_DHT_get_stop(global_get_handle);
191 } 191 global_get_handle = NULL;
192 else 192 }
193 { 193 GNUNET_SCHEDULER_add_now(sched, &end_badly_cont, NULL);
194 GNUNET_SCHEDULER_add_now(sched, &end_badly_cont, NULL);
195 }
196
197 ok = 1; 194 ok = 1;
198} 195}
199 196
@@ -210,7 +207,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
210void get_result_iterator (void *cls, 207void get_result_iterator (void *cls,
211 struct GNUNET_TIME_Absolute exp, 208 struct GNUNET_TIME_Absolute exp,
212 const GNUNET_HashCode * key, 209 const GNUNET_HashCode * key,
213 uint32_t type, 210 const struct GNUNET_PeerIdentity * const *get_path,
211 const struct GNUNET_PeerIdentity * const *put_path,
212 enum GNUNET_BLOCK_Type type,
214 uint32_t size, 213 uint32_t size,
215 const void *data) 214 const void *data)
216{ 215{
@@ -229,7 +228,8 @@ void get_result_iterator (void *cls,
229 228
230 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct GET response!\n"); 229 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct GET response!\n");
231 GNUNET_SCHEDULER_cancel(sched, die_task); 230 GNUNET_SCHEDULER_cancel(sched, die_task);
232 GNUNET_DHT_get_stop(global_get_handle, &finish_testing, NULL); 231 GNUNET_DHT_get_stop(global_get_handle);
232 GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL);
233} 233}
234 234
235/** 235/**
@@ -240,7 +240,12 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
240{ 240{
241 GNUNET_HashCode key; /* Key for data lookup */ 241 GNUNET_HashCode key; /* Key for data lookup */
242 memset(&key, 42, sizeof(GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */ 242 memset(&key, 42, sizeof(GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
243 global_get_handle = GNUNET_DHT_get_start(peer2dht, GNUNET_TIME_relative_get_forever(), 1, &key, &get_result_iterator, NULL, NULL, NULL); 243 global_get_handle = GNUNET_DHT_get_start(peer2dht, GNUNET_TIME_relative_get_forever(),
244 1 /* FIXME: use real type */, &key,
245 GNUNET_DHT_RO_NONE,
246 NULL, 0,
247 NULL, 0,
248 &get_result_iterator, NULL);
244} 249}
245 250
246/** 251/**
@@ -270,10 +275,11 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
270 /* Insert the data at the first peer */ 275 /* Insert the data at the first peer */
271 GNUNET_DHT_put(peer1dht, 276 GNUNET_DHT_put(peer1dht,
272 &key, 277 &key,
273 1, 278 GNUNET_DHT_RO_NONE,
279 1 /* FIXME: use real type */,
274 sizeof(data), data, 280 sizeof(data), data,
275 GNUNET_TIME_absolute_get_forever(), 281 GNUNET_TIME_UNIT_FOREVER_ABS,
276 GNUNET_TIME_relative_get_forever(), 282 GNUNET_TIME_UNIT_FOREVER_REL,
277 &put_finished, NULL); 283 &put_finished, NULL);
278} 284}
279 285