diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-service-dht.h | 1 | ||||
-rw-r--r-- | src/dht/test_dht_multipeer.c | 10 | ||||
-rw-r--r-- | src/dht/test_dht_twopeer_path_tracking.c | 29 |
3 files changed, 15 insertions, 25 deletions
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h index 7cacdba7a..2877a156b 100644 --- a/src/dht/gnunet-service-dht.h +++ b/src/dht/gnunet-service-dht.h | |||
@@ -35,7 +35,6 @@ | |||
35 | */ | 35 | */ |
36 | extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg; | 36 | extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg; |
37 | 37 | ||
38 | |||
39 | /** | 38 | /** |
40 | * Our handle to the BLOCK library. | 39 | * Our handle to the BLOCK library. |
41 | */ | 40 | */ |
diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c index acc9b1652..8133c7576 100644 --- a/src/dht/test_dht_multipeer.c +++ b/src/dht/test_dht_multipeer.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "gnunet_dht_service.h" | 28 | #include "gnunet_dht_service.h" |
29 | 29 | ||
30 | /* DEFINES */ | 30 | /* DEFINES */ |
31 | #define VERBOSE GNUNET_NO | 31 | #define VERBOSE GNUNET_YES |
32 | 32 | ||
33 | /* Timeout for entire testcase */ | 33 | /* Timeout for entire testcase */ |
34 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5) | 34 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5) |
@@ -549,8 +549,8 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
549 | GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL, | 549 | GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL, |
550 | &put_finished, test_put); | 550 | &put_finished, test_put); |
551 | test_put->disconnect_task = | 551 | test_put->disconnect_task = |
552 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (), | 552 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
553 | &put_disconnect_task, test_put); | 553 | &put_disconnect_task, test_put); |
554 | GNUNET_SCHEDULER_add_now (&do_put, test_put->next); | 554 | GNUNET_SCHEDULER_add_now (&do_put, test_put->next); |
555 | } | 555 | } |
556 | 556 | ||
@@ -609,7 +609,7 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
609 | * The emsg variable is NULL on success (peers connected), and non-NULL on | 609 | * The emsg variable is NULL on success (peers connected), and non-NULL on |
610 | * failure (peers failed to connect). | 610 | * failure (peers failed to connect). |
611 | */ | 611 | */ |
612 | void | 612 | static void |
613 | topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, | 613 | topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, |
614 | const struct GNUNET_PeerIdentity *second, uint32_t distance, | 614 | const struct GNUNET_PeerIdentity *second, uint32_t distance, |
615 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, | 615 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, |
@@ -752,7 +752,7 @@ create_topology () | |||
752 | * @param d the daemon handle (pretty useless at this point, remove?) | 752 | * @param d the daemon handle (pretty useless at this point, remove?) |
753 | * @param emsg non-null on failure | 753 | * @param emsg non-null on failure |
754 | */ | 754 | */ |
755 | void | 755 | static void |
756 | hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id, | 756 | hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id, |
757 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | 757 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
758 | { | 758 | { |
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, |