diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-16 21:52:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-16 21:52:04 +0000 |
commit | dbc823a07a03e1085172038125b0edf15b0dc6fe (patch) | |
tree | 4e7c3bf60ce83e801c69a6566ea36d514b571cba /src/namestore/test_namestore_api_store_update.c | |
parent | eec0e5088ec9437f5c0cf9d3ffef87603ad2777a (diff) | |
download | gnunet-dbc823a07a03e1085172038125b0edf15b0dc6fe.tar.gz gnunet-dbc823a07a03e1085172038125b0edf15b0dc6fe.zip |
-finishing split of namestore into namestore and namecache (#3065) -- in theory; in practice, somehow something broke badly, so the tests are now failing
Diffstat (limited to 'src/namestore/test_namestore_api_store_update.c')
-rw-r--r-- | src/namestore/test_namestore_api_store_update.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 4a0a36bb8..1440addbe 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * @author Matthias Wachs | 23 | * @author Matthias Wachs |
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_namecache_service.h" | ||
26 | #include "gnunet_namestore_service.h" | 27 | #include "gnunet_namestore_service.h" |
27 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
28 | 29 | ||
@@ -44,6 +45,8 @@ | |||
44 | 45 | ||
45 | static struct GNUNET_NAMESTORE_Handle *nsh; | 46 | static struct GNUNET_NAMESTORE_Handle *nsh; |
46 | 47 | ||
48 | static struct GNUNET_NAMECACHE_Handle *nch; | ||
49 | |||
47 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; | 50 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; |
48 | 51 | ||
49 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 52 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; |
@@ -56,6 +59,8 @@ static int update_performed; | |||
56 | 59 | ||
57 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; | 60 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; |
58 | 61 | ||
62 | static struct GNUNET_NAMECACHE_QueueEntry *ncqe; | ||
63 | |||
59 | static const char * name = "dummy.dummy.gnunet"; | 64 | static const char * name = "dummy.dummy.gnunet"; |
60 | 65 | ||
61 | 66 | ||
@@ -67,6 +72,11 @@ cleanup () | |||
67 | GNUNET_NAMESTORE_disconnect (nsh); | 72 | GNUNET_NAMESTORE_disconnect (nsh); |
68 | nsh = NULL; | 73 | nsh = NULL; |
69 | } | 74 | } |
75 | if (NULL != nch) | ||
76 | { | ||
77 | GNUNET_NAMECACHE_disconnect (nch); | ||
78 | nch = NULL; | ||
79 | } | ||
70 | if (NULL != privkey) | 80 | if (NULL != privkey) |
71 | { | 81 | { |
72 | GNUNET_free (privkey); | 82 | GNUNET_free (privkey); |
@@ -91,6 +101,11 @@ endbadly (void *cls, | |||
91 | GNUNET_NAMESTORE_cancel (nsqe); | 101 | GNUNET_NAMESTORE_cancel (nsqe); |
92 | nsqe = NULL; | 102 | nsqe = NULL; |
93 | } | 103 | } |
104 | if (NULL != ncqe) | ||
105 | { | ||
106 | GNUNET_NAMECACHE_cancel (ncqe); | ||
107 | ncqe = NULL; | ||
108 | } | ||
94 | cleanup (); | 109 | cleanup (); |
95 | res = 1; | 110 | res = 1; |
96 | } | 111 | } |
@@ -161,10 +176,9 @@ name_lookup_proc (void *cls, | |||
161 | const struct GNUNET_GNSRECORD_Block *block) | 176 | const struct GNUNET_GNSRECORD_Block *block) |
162 | { | 177 | { |
163 | const char *name = cls; | 178 | const char *name = cls; |
164 | nsqe = NULL; | ||
165 | 179 | ||
180 | ncqe = NULL; | ||
166 | GNUNET_assert (NULL != cls); | 181 | GNUNET_assert (NULL != cls); |
167 | |||
168 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 182 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |
169 | { | 183 | { |
170 | GNUNET_SCHEDULER_cancel (endbadly_task); | 184 | GNUNET_SCHEDULER_cancel (endbadly_task); |
@@ -194,18 +208,16 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
194 | const char *name = cls; | 208 | const char *name = cls; |
195 | struct GNUNET_HashCode derived_hash; | 209 | struct GNUNET_HashCode derived_hash; |
196 | 210 | ||
211 | nsqe = NULL; | ||
197 | GNUNET_assert (NULL != cls); | 212 | GNUNET_assert (NULL != cls); |
198 | |||
199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
200 | "Name store added record for `%s': %s\n", | 214 | "Name store added record for `%s': %s\n", |
201 | name, | 215 | name, |
202 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); | 216 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); |
203 | |||
204 | /* Create derived hash */ | 217 | /* Create derived hash */ |
205 | GNUNET_GNSRECORD_query_from_private_key (privkey, name, &derived_hash); | 218 | GNUNET_GNSRECORD_query_from_private_key (privkey, name, &derived_hash); |
206 | 219 | ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, | |
207 | nsqe = GNUNET_NAMESTORE_lookup_block (nsh, &derived_hash, | 220 | &name_lookup_proc, (void *) name); |
208 | &name_lookup_proc, (void *) name); | ||
209 | } | 221 | } |
210 | 222 | ||
211 | 223 | ||
@@ -239,6 +251,8 @@ run (void *cls, | |||
239 | 251 | ||
240 | nsh = GNUNET_NAMESTORE_connect (cfg); | 252 | nsh = GNUNET_NAMESTORE_connect (cfg); |
241 | GNUNET_break (NULL != nsh); | 253 | GNUNET_break (NULL != nsh); |
254 | nch = GNUNET_NAMECACHE_connect (cfg); | ||
255 | GNUNET_break (NULL != nch); | ||
242 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | 256 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, |
243 | 1, &rd, &put_cont, (void *) name); | 257 | 1, &rd, &put_cont, (void *) name); |
244 | if (NULL == nsqe) | 258 | if (NULL == nsqe) |