aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_monitoring_existing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-05 23:18:00 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-05 23:18:00 +0200
commit645b26ba88218c4a2f9a022968a8c03e9035082d (patch)
tree7a32403fdd32c4f1b01ddc78de920f4b01bd7d9b /src/namestore/test_namestore_api_monitoring_existing.c
parent04a5c505163a84f8a7097dc7b32cf8051c74c214 (diff)
downloadgnunet-645b26ba88218c4a2f9a022968a8c03e9035082d.tar.gz
gnunet-645b26ba88218c4a2f9a022968a8c03e9035082d.zip
update namestore monitor API users to use new _next call where needed
Diffstat (limited to 'src/namestore/test_namestore_api_monitoring_existing.c')
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c55
1 files changed, 38 insertions, 17 deletions
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 17f726eb1..f6a74609e 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -159,19 +159,24 @@ zone_proc (void *cls,
159 "Comparing results name %s\n", 159 "Comparing results name %s\n",
160 name); 160 name);
161 161
162 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 162 if (0 != memcmp (zone_key,
163 privkey,
164 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
163 { 165 {
164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
165 "Monitoring returned wrong zone key\n"); 167 "Monitoring returned wrong zone key\n");
166 GNUNET_break (0); 168 GNUNET_break (0);
167 GNUNET_SCHEDULER_cancel (endbadly_task); 169 GNUNET_SCHEDULER_cancel (endbadly_task);
168 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 170 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
171 NULL);
169 return; 172 return;
170 } 173 }
171 174
172 if (0 == strcmp (name, s_name_1)) 175 if (0 == strcmp (name, s_name_1))
173 { 176 {
174 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_1)) 177 if (GNUNET_YES !=
178 GNUNET_GNSRECORD_records_cmp (rd,
179 s_rd_1))
175 { 180 {
176 GNUNET_break (0); 181 GNUNET_break (0);
177 fail = GNUNET_YES; 182 fail = GNUNET_YES;
@@ -179,7 +184,9 @@ zone_proc (void *cls,
179 } 184 }
180 else if (0 == strcmp (name, s_name_2)) 185 else if (0 == strcmp (name, s_name_2))
181 { 186 {
182 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_2)) 187 if (GNUNET_YES !=
188 GNUNET_GNSRECORD_records_cmp (rd,
189 s_rd_2))
183 { 190 {
184 GNUNET_break (0); 191 GNUNET_break (0);
185 fail = GNUNET_YES; 192 fail = GNUNET_YES;
@@ -192,7 +199,8 @@ zone_proc (void *cls,
192 GNUNET_break (0); 199 GNUNET_break (0);
193 fail = GNUNET_YES; 200 fail = GNUNET_YES;
194 } 201 }
195 202 GNUNET_NAMESTORE_zone_monitor_next (zm,
203 1);
196 if (2 == ++returned_records) 204 if (2 == ++returned_records)
197 { 205 {
198 if (endbadly_task != NULL) 206 if (endbadly_task != NULL)
@@ -201,9 +209,11 @@ zone_proc (void *cls,
201 endbadly_task = NULL; 209 endbadly_task = NULL;
202 } 210 }
203 if (GNUNET_YES == fail) 211 if (GNUNET_YES == fail)
204 GNUNET_SCHEDULER_add_now (&endbadly, NULL); 212 GNUNET_SCHEDULER_add_now (&endbadly,
213 NULL);
205 else 214 else
206 GNUNET_SCHEDULER_add_now (&end, NULL); 215 GNUNET_SCHEDULER_add_now (&end,
216 NULL);
207 } 217 }
208} 218}
209 219
@@ -223,7 +233,9 @@ sync_cb (void *cls)
223 233
224 234
225static void 235static void
226put_cont (void *cls, int32_t success, const char *emsg) 236put_cont (void *cls,
237 int32_t success,
238 const char *emsg)
227{ 239{
228 static int c = 0; 240 static int c = 0;
229 char *label = cls; 241 char *label = cls;
@@ -238,11 +250,15 @@ put_cont (void *cls, int32_t success, const char *emsg)
238 if (success == GNUNET_OK) 250 if (success == GNUNET_OK)
239 { 251 {
240 c++; 252 c++;
241 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record %u: `%s'\n", c, label); 253 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
254 "Created record %u: `%s'\n",
255 c,
256 label);
242 } 257 }
243 else 258 else
244 { 259 {
245 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records\n"); 260 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
261 "Failed to created records\n");
246 GNUNET_break (0); 262 GNUNET_break (0);
247 GNUNET_SCHEDULER_cancel (endbadly_task); 263 GNUNET_SCHEDULER_cancel (endbadly_task);
248 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 264 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
@@ -262,9 +278,11 @@ put_cont (void *cls, int32_t success, const char *emsg)
262 NULL); 278 NULL);
263 if (NULL == zm) 279 if (NULL == zm)
264 { 280 {
265 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone monitor\n"); 281 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
282 "Failed to create zone monitor\n");
266 GNUNET_break (0); 283 GNUNET_break (0);
267 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 284 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
285 NULL);
268 return; 286 return;
269 } 287 }
270 } 288 }
@@ -354,14 +372,17 @@ run (void *cls,
354 GNUNET_assert (NULL != (ns_ops[0] = GNUNET_NAMESTORE_records_store(nsh, privkey, s_name_1, 372 GNUNET_assert (NULL != (ns_ops[0] = GNUNET_NAMESTORE_records_store(nsh, privkey, s_name_1,
355 1, s_rd_1, &put_cont, s_name_1))); 373 1, s_rd_1, &put_cont, s_name_1)));
356 374
357
358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n"); 375 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n");
359 GNUNET_asprintf(&s_name_2, "dummy2"); 376 GNUNET_asprintf(&s_name_2, "dummy2");
360 s_rd_2 = create_record(1); 377 s_rd_2 = create_record(1);
361 GNUNET_assert (NULL != (ns_ops[1] = GNUNET_NAMESTORE_records_store(nsh, privkey, s_name_2, 378 GNUNET_assert (NULL != (ns_ops[1] =
362 1, s_rd_2, &put_cont, s_name_2))); 379 GNUNET_NAMESTORE_records_store (nsh,
363 380 privkey,
364 381 s_name_2,
382 1,
383 s_rd_2,
384 &put_cont,
385 s_name_2)));
365} 386}
366 387
367 388