diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-09-28 07:52:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-09-28 07:52:34 +0000 |
commit | aa01c9decb353071619a1186004135bbea392f39 (patch) | |
tree | 95fa96c099bc3b75039da6abb151910091bf707b /src/dht/test_dht_twopeer_path_tracking.c | |
parent | 434a4b0ca9418ec31eec243e5f77c1af8e67a070 (diff) | |
download | gnunet-aa01c9decb353071619a1186004135bbea392f39.tar.gz gnunet-aa01c9decb353071619a1186004135bbea392f39.zip |
cleanup
Diffstat (limited to 'src/dht/test_dht_twopeer_path_tracking.c')
-rw-r--r-- | src/dht/test_dht_twopeer_path_tracking.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/dht/test_dht_twopeer_path_tracking.c b/src/dht/test_dht_twopeer_path_tracking.c index e88b7c8e9..5be36c4a1 100644 --- a/src/dht/test_dht_twopeer_path_tracking.c +++ b/src/dht/test_dht_twopeer_path_tracking.c | |||
@@ -187,7 +187,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
187 | * @param size number of bytes in data | 187 | * @param size number of bytes in data |
188 | * @param data pointer to the result data | 188 | * @param data pointer to the result data |
189 | */ | 189 | */ |
190 | void | 190 | static void |
191 | get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | 191 | get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, |
192 | const GNUNET_HashCode * key, | 192 | const GNUNET_HashCode * key, |
193 | const struct GNUNET_PeerIdentity *get_path, | 193 | const struct GNUNET_PeerIdentity *get_path, |
@@ -239,21 +239,6 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, | |||
239 | GNUNET_SCHEDULER_add_now (&finish_testing, NULL); | 239 | GNUNET_SCHEDULER_add_now (&finish_testing, NULL); |
240 | } | 240 | } |
241 | 241 | ||
242 | /** | ||
243 | * Start the GET request for the same key/data that was inserted. | ||
244 | */ | ||
245 | static void | ||
246 | do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
247 | { | ||
248 | GNUNET_HashCode key; /* Key for data lookup */ | ||
249 | |||
250 | memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */ | ||
251 | global_get_handle = | ||
252 | GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (), | ||
253 | GNUNET_BLOCK_TYPE_TEST, &key, | ||
254 | 1, GNUNET_DHT_RO_RECORD_ROUTE, | ||
255 | NULL, 0, &get_result_iterator, NULL); | ||
256 | } | ||
257 | 242 | ||
258 | /** | 243 | /** |
259 | * Called when the PUT request has been transmitted to the DHT service. | 244 | * Called when the PUT request has been transmitted to the DHT service. |
@@ -262,12 +247,18 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
262 | static void | 247 | static void |
263 | put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 248 | put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
264 | { | 249 | { |
250 | GNUNET_HashCode key; /* Key for data lookup */ | ||
251 | |||
265 | GNUNET_SCHEDULER_cancel (die_task); | 252 | GNUNET_SCHEDULER_cancel (die_task); |
266 | die_task = | 253 | die_task = |
267 | GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly, | 254 | GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly, |
268 | "waiting for get response (data not found)"); | 255 | "waiting for get response (data not found)"); |
269 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 256 | memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */ |
270 | (GNUNET_TIME_UNIT_SECONDS, 10), &do_get, NULL); | 257 | global_get_handle = |
258 | GNUNET_DHT_get_start (peer2dht, GNUNET_TIME_relative_get_forever (), | ||
259 | GNUNET_BLOCK_TYPE_TEST, &key, | ||
260 | 1, GNUNET_DHT_RO_RECORD_ROUTE, | ||
261 | NULL, 0, &get_result_iterator, NULL); | ||
271 | } | 262 | } |
272 | 263 | ||
273 | /** | 264 | /** |
@@ -298,7 +289,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
298 | * The emsg variable is NULL on success (peers connected), and non-NULL on | 289 | * The emsg variable is NULL on success (peers connected), and non-NULL on |
299 | * failure (peers failed to connect). | 290 | * failure (peers failed to connect). |
300 | */ | 291 | */ |
301 | void | 292 | static void |
302 | topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, | 293 | topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, |
303 | const struct GNUNET_PeerIdentity *second, uint32_t distance, | 294 | const struct GNUNET_PeerIdentity *second, uint32_t distance, |
304 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, | 295 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, |