diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-09 17:33:04 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-09 17:33:04 +0200 |
commit | 8bb475af99260f1d107dbc8908268ae93960aa83 (patch) | |
tree | 1a7a1fc03424df841a6f977b137482439b09bc9f /src/namestore/test_namestore_api_lookup_shadow.c | |
parent | 1f80a11e90ee982bffaae4685e281f75ee1c225d (diff) | |
download | gnunet-8bb475af99260f1d107dbc8908268ae93960aa83.tar.gz gnunet-8bb475af99260f1d107dbc8908268ae93960aa83.zip |
implement new functions in libgnunetsq, clean up sqlite namestore plugin, implement flow control in namestore API and tests
Diffstat (limited to 'src/namestore/test_namestore_api_lookup_shadow.c')
-rw-r--r-- | src/namestore/test_namestore_api_lookup_shadow.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index e80335796..39ce4e564 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c | |||
@@ -53,7 +53,6 @@ static struct GNUNET_NAMESTORE_QueueEntry *nsqe; | |||
53 | 53 | ||
54 | static struct GNUNET_NAMECACHE_QueueEntry *ncqe; | 54 | static struct GNUNET_NAMECACHE_QueueEntry *ncqe; |
55 | 55 | ||
56 | static char *directory; | ||
57 | 56 | ||
58 | static void | 57 | static void |
59 | cleanup () | 58 | cleanup () |
@@ -222,26 +221,15 @@ run (void *cls, | |||
222 | struct GNUNET_TESTING_Peer *peer) | 221 | struct GNUNET_TESTING_Peer *peer) |
223 | { | 222 | { |
224 | struct GNUNET_GNSRECORD_Data rd; | 223 | struct GNUNET_GNSRECORD_Data rd; |
225 | char *hostkey_file; | ||
226 | const char * name = "dummy.dummy.gnunet"; | 224 | const char * name = "dummy.dummy.gnunet"; |
227 | 225 | ||
228 | directory = NULL; | ||
229 | GNUNET_assert (GNUNET_OK == | ||
230 | GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory)); | ||
231 | GNUNET_DISK_directory_remove (directory); | ||
232 | |||
233 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 226 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
234 | &endbadly, NULL); | 227 | &endbadly, |
235 | GNUNET_asprintf (&hostkey_file, | 228 | NULL); |
236 | "zonefiles%s%s", | 229 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); |
237 | DIR_SEPARATOR_STR, | ||
238 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | ||
239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); | ||
240 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | ||
241 | GNUNET_free (hostkey_file); | ||
242 | GNUNET_assert (privkey != NULL); | 230 | GNUNET_assert (privkey != NULL); |
243 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); | 231 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, |
244 | 232 | &pubkey); | |
245 | rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; | 233 | rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; |
246 | rd.record_type = TEST_RECORD_TYPE; | 234 | rd.record_type = TEST_RECORD_TYPE; |
247 | rd.data_size = TEST_RECORD_DATALEN; | 235 | rd.data_size = TEST_RECORD_DATALEN; |
@@ -253,8 +241,13 @@ run (void *cls, | |||
253 | nch = GNUNET_NAMECACHE_connect (cfg); | 241 | nch = GNUNET_NAMECACHE_connect (cfg); |
254 | GNUNET_break (NULL != nsh); | 242 | GNUNET_break (NULL != nsh); |
255 | GNUNET_break (NULL != nch); | 243 | GNUNET_break (NULL != nch); |
256 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | 244 | nsqe = GNUNET_NAMESTORE_records_store (nsh, |
257 | 1, &rd, &put_cont, (void *) name); | 245 | privkey, |
246 | name, | ||
247 | 1, | ||
248 | &rd, | ||
249 | &put_cont, | ||
250 | (void *) name); | ||
258 | if (NULL == nsqe) | 251 | if (NULL == nsqe) |
259 | { | 252 | { |
260 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 253 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -274,6 +267,8 @@ main (int argc, char *argv[]) | |||
274 | GNUNET_asprintf (&cfg_name, | 267 | GNUNET_asprintf (&cfg_name, |
275 | "test_namestore_api_%s.conf", | 268 | "test_namestore_api_%s.conf", |
276 | plugin_name); | 269 | plugin_name); |
270 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
271 | "GNUNET_TEST_HOME"); | ||
277 | res = 1; | 272 | res = 1; |
278 | if (0 != | 273 | if (0 != |
279 | GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow", | 274 | GNUNET_TESTING_peer_run ("test-namestore-api-lookup-shadow", |
@@ -284,11 +279,8 @@ main (int argc, char *argv[]) | |||
284 | res = 1; | 279 | res = 1; |
285 | } | 280 | } |
286 | GNUNET_free (cfg_name); | 281 | GNUNET_free (cfg_name); |
287 | if (NULL != directory) | 282 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
288 | { | 283 | "GNUNET_TEST_HOME"); |
289 | GNUNET_DISK_directory_remove (directory); | ||
290 | GNUNET_free (directory); | ||
291 | } | ||
292 | return res; | 284 | return res; |
293 | } | 285 | } |
294 | 286 | ||