diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-25 16:18:31 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-25 16:18:31 +0200 |
commit | 4dc79497d7f745996068e62e973e34d220580323 (patch) | |
tree | e6d429d3cf2240ec3459f1d4533201dc40b27015 /src/namestore/test_namestore_api_monitoring_existing.c | |
parent | bdbb7c684f2c9711989d2543ecc08a95be23e6c4 (diff) | |
download | gnunet-4dc79497d7f745996068e62e973e34d220580323.tar.gz gnunet-4dc79497d7f745996068e62e973e34d220580323.zip |
extend namestore API to enable faster iterations by returning more than one result at a time
Diffstat (limited to 'src/namestore/test_namestore_api_monitoring_existing.c')
-rw-r--r-- | src/namestore/test_namestore_api_monitoring_existing.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index cd1838b5c..374ad44dd 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c | |||
@@ -71,18 +71,18 @@ do_shutdown () | |||
71 | 71 | ||
72 | if (NULL != ns_ops[0]) | 72 | if (NULL != ns_ops[0]) |
73 | { | 73 | { |
74 | GNUNET_NAMESTORE_cancel(ns_ops[0]); | 74 | GNUNET_NAMESTORE_cancel(ns_ops[0]); |
75 | ns_ops[0] = NULL; | 75 | ns_ops[0] = NULL; |
76 | } | 76 | } |
77 | if (NULL != ns_ops[1]) | 77 | if (NULL != ns_ops[1]) |
78 | { | 78 | { |
79 | GNUNET_NAMESTORE_cancel(ns_ops[1]); | 79 | GNUNET_NAMESTORE_cancel(ns_ops[1]); |
80 | ns_ops[1] = NULL; | 80 | ns_ops[1] = NULL; |
81 | } | 81 | } |
82 | if (NULL != ns_ops[2]) | 82 | if (NULL != ns_ops[2]) |
83 | { | 83 | { |
84 | GNUNET_NAMESTORE_cancel(ns_ops[2]); | 84 | GNUNET_NAMESTORE_cancel(ns_ops[2]); |
85 | ns_ops[2] = NULL; | 85 | ns_ops[2] = NULL; |
86 | } | 86 | } |
87 | 87 | ||
88 | if (NULL != nsh) | 88 | if (NULL != nsh) |
@@ -274,18 +274,20 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
274 | static struct GNUNET_GNSRECORD_Data * | 274 | static struct GNUNET_GNSRECORD_Data * |
275 | create_record (unsigned int count) | 275 | create_record (unsigned int count) |
276 | { | 276 | { |
277 | unsigned int c; | ||
278 | struct GNUNET_GNSRECORD_Data * rd; | 277 | struct GNUNET_GNSRECORD_Data * rd; |
279 | 278 | ||
280 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data)); | 279 | rd = GNUNET_new_array (count, |
281 | for (c = 0; c < count; c++) | 280 | struct GNUNET_GNSRECORD_Data); |
281 | for (unsigned int c = 0; c < count; c++) | ||
282 | { | 282 | { |
283 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 283 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
284 | rd[c].record_type = 1111; | 284 | rd[c].record_type = 1111; |
285 | rd[c].data_size = 50; | 285 | rd[c].data_size = 50; |
286 | rd[c].data = GNUNET_malloc(50); | 286 | rd[c].data = GNUNET_malloc(50); |
287 | rd[c].flags = 0; | 287 | rd[c].flags = 0; |
288 | memset ((char *) rd[c].data, 'a', 50); | 288 | memset ((char *) rd[c].data, |
289 | 'a', | ||
290 | 50); | ||
289 | } | 291 | } |
290 | return rd; | 292 | return rd; |
291 | } | 293 | } |
@@ -300,7 +302,10 @@ run (void *cls, | |||
300 | 302 | ||
301 | directory = NULL; | 303 | directory = NULL; |
302 | GNUNET_assert (GNUNET_OK == | 304 | GNUNET_assert (GNUNET_OK == |
303 | GNUNET_CONFIGURATION_get_value_string(mycfg, "PATHS", "GNUNET_TEST_HOME", &directory)); | 305 | GNUNET_CONFIGURATION_get_value_string (mycfg, |
306 | "PATHS", | ||
307 | "GNUNET_TEST_HOME", | ||
308 | &directory)); | ||
304 | GNUNET_DISK_directory_remove (directory); | 309 | GNUNET_DISK_directory_remove (directory); |
305 | 310 | ||
306 | res = 1; | 311 | res = 1; |