aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-25 12:38:23 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-25 12:38:23 +0200
commitd964554dd20a3668e7fcca913aaa9aa71d2fed6e (patch)
tree335fcba330824ca4b8e515917da828ce4544f5fb
parentbd31d846be8f5c98e35935a77d7ccca94e2fb201 (diff)
downloadgnunet-d964554dd20a3668e7fcca913aaa9aa71d2fed6e.tar.gz
gnunet-d964554dd20a3668e7fcca913aaa9aa71d2fed6e.zip
remove bogus cast
-rw-r--r--src/namestore/namestore_api.c401
1 files changed, 148 insertions, 253 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 99fd17473..6c64062ea 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -38,7 +38,7 @@
38#include "namestore.h" 38#include "namestore.h"
39 39
40 40
41#define LOG(kind,...) GNUNET_log_from (kind, "namestore-api",__VA_ARGS__) 41#define LOG(kind, ...) GNUNET_log_from (kind, "namestore-api", __VA_ARGS__)
42 42
43/** 43/**
44 * We grant the namestore up to 1 minute of latency, if it is slower than 44 * We grant the namestore up to 1 minute of latency, if it is slower than
@@ -113,7 +113,6 @@ struct GNUNET_NAMESTORE_QueueEntry
113 * The operation id this zone iteration operation has 113 * The operation id this zone iteration operation has
114 */ 114 */
115 uint32_t op_id; 115 uint32_t op_id;
116
117}; 116};
118 117
119 118
@@ -183,7 +182,6 @@ struct GNUNET_NAMESTORE_ZoneIterator
183 * The operation id this zone iteration operation has 182 * The operation id this zone iteration operation has
184 */ 183 */
185 uint32_t op_id; 184 uint32_t op_id;
186
187}; 185};
188 186
189 187
@@ -242,7 +240,6 @@ struct GNUNET_NAMESTORE_Handle
242 * The last operation id used for a NAMESTORE operation 240 * The last operation id used for a NAMESTORE operation
243 */ 241 */
244 uint32_t last_op_id_used; 242 uint32_t last_op_id_used;
245
246}; 243};
247 244
248 245
@@ -263,8 +260,7 @@ force_reconnect (struct GNUNET_NAMESTORE_Handle *h);
263 * @return NULL if @a rid was not found 260 * @return NULL if @a rid was not found
264 */ 261 */
265static struct GNUNET_NAMESTORE_QueueEntry * 262static struct GNUNET_NAMESTORE_QueueEntry *
266find_qe (struct GNUNET_NAMESTORE_Handle *h, 263find_qe (struct GNUNET_NAMESTORE_Handle *h, uint32_t rid)
267 uint32_t rid)
268{ 264{
269 struct GNUNET_NAMESTORE_QueueEntry *qe; 265 struct GNUNET_NAMESTORE_QueueEntry *qe;
270 266
@@ -283,8 +279,7 @@ find_qe (struct GNUNET_NAMESTORE_Handle *h,
283 * @return NULL if @a rid was not found 279 * @return NULL if @a rid was not found
284 */ 280 */
285static struct GNUNET_NAMESTORE_ZoneIterator * 281static struct GNUNET_NAMESTORE_ZoneIterator *
286find_zi (struct GNUNET_NAMESTORE_Handle *h, 282find_zi (struct GNUNET_NAMESTORE_Handle *h, uint32_t rid)
287 uint32_t rid)
288{ 283{
289 struct GNUNET_NAMESTORE_ZoneIterator *ze; 284 struct GNUNET_NAMESTORE_ZoneIterator *ze;
290 285
@@ -305,9 +300,7 @@ free_qe (struct GNUNET_NAMESTORE_QueueEntry *qe)
305{ 300{
306 struct GNUNET_NAMESTORE_Handle *h = qe->h; 301 struct GNUNET_NAMESTORE_Handle *h = qe->h;
307 302
308 GNUNET_CONTAINER_DLL_remove (h->op_head, 303 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, qe);
309 h->op_tail,
310 qe);
311 if (NULL != qe->env) 304 if (NULL != qe->env)
312 GNUNET_MQ_discard (qe->env); 305 GNUNET_MQ_discard (qe->env);
313 if (NULL != qe->timeout_task) 306 if (NULL != qe->timeout_task)
@@ -326,9 +319,7 @@ free_ze (struct GNUNET_NAMESTORE_ZoneIterator *ze)
326{ 319{
327 struct GNUNET_NAMESTORE_Handle *h = ze->h; 320 struct GNUNET_NAMESTORE_Handle *h = ze->h;
328 321
329 GNUNET_CONTAINER_DLL_remove (h->z_head, 322 GNUNET_CONTAINER_DLL_remove (h->z_head, h->z_tail, ze);
330 h->z_tail,
331 ze);
332 if (NULL != ze->env) 323 if (NULL != ze->env)
333 GNUNET_MQ_discard (ze->env); 324 GNUNET_MQ_discard (ze->env);
334 GNUNET_free (ze); 325 GNUNET_free (ze);
@@ -345,17 +336,12 @@ free_ze (struct GNUNET_NAMESTORE_ZoneIterator *ze)
345 * @return #GNUNET_OK if @a rd_buf is well-formed 336 * @return #GNUNET_OK if @a rd_buf is well-formed
346 */ 337 */
347static int 338static int
348check_rd (size_t rd_len, 339check_rd (size_t rd_len, const void *rd_buf, unsigned int rd_count)
349 const void *rd_buf,
350 unsigned int rd_count)
351{ 340{
352 struct GNUNET_GNSRECORD_Data rd[rd_count]; 341 struct GNUNET_GNSRECORD_Data rd[rd_count];
353 342
354 if (GNUNET_OK != 343 if (GNUNET_OK !=
355 GNUNET_GNSRECORD_records_deserialize (rd_len, 344 GNUNET_GNSRECORD_records_deserialize (rd_len, rd_buf, rd_count, rd))
356 rd_buf,
357 rd_count,
358 rd))
359 { 345 {
360 GNUNET_break (0); 346 GNUNET_break (0);
361 return GNUNET_SYSERR; 347 return GNUNET_SYSERR;
@@ -373,28 +359,25 @@ check_rd (size_t rd_len,
373 */ 359 */
374static void 360static void
375handle_record_store_response (void *cls, 361handle_record_store_response (void *cls,
376 const struct RecordStoreResponseMessage *msg) 362 const struct RecordStoreResponseMessage *msg)
377{ 363{
378 struct GNUNET_NAMESTORE_Handle *h = cls; 364 struct GNUNET_NAMESTORE_Handle *h = cls;
379 struct GNUNET_NAMESTORE_QueueEntry *qe; 365 struct GNUNET_NAMESTORE_QueueEntry *qe;
380 int res; 366 int res;
381 const char *emsg; 367 const char *emsg;
382 368
383 qe = find_qe (h, 369 qe = find_qe (h, ntohl (msg->gns_header.r_id));
384 ntohl (msg->gns_header.r_id));
385 res = ntohl (msg->op_result); 370 res = ntohl (msg->op_result);
386 LOG (GNUNET_ERROR_TYPE_DEBUG, 371 LOG (GNUNET_ERROR_TYPE_DEBUG,
387 "Received RECORD_STORE_RESPONSE with result %d\n", 372 "Received RECORD_STORE_RESPONSE with result %d\n",
388 res); 373 res);
389 /* TODO: add actual error message from namestore to response... */ 374 /* TODO: add actual error message from namestore to response... */
390 if (GNUNET_SYSERR == res) 375 if (GNUNET_SYSERR == res)
391 emsg = _("Namestore failed to store record\n"); 376 emsg = _ ("Namestore failed to store record\n");
392 else 377 else
393 emsg = NULL; 378 emsg = NULL;
394 if (NULL != qe->cont) 379 if (NULL != qe->cont)
395 qe->cont (qe->cont_cls, 380 qe->cont (qe->cont_cls, res, emsg);
396 res,
397 emsg);
398 free_qe (qe); 381 free_qe (qe);
399} 382}
400 383
@@ -408,8 +391,7 @@ handle_record_store_response (void *cls,
408 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 391 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
409 */ 392 */
410static int 393static int
411check_lookup_result (void *cls, 394check_lookup_result (void *cls, const struct LabelLookupResponseMessage *msg)
412 const struct LabelLookupResponseMessage *msg)
413{ 395{
414 const char *name; 396 const char *name;
415 size_t exp_msg_len; 397 size_t exp_msg_len;
@@ -428,8 +410,7 @@ check_lookup_result (void *cls,
428 return GNUNET_SYSERR; 410 return GNUNET_SYSERR;
429 } 411 }
430 name = (const char *) &msg[1]; 412 name = (const char *) &msg[1];
431 if ( (name_len > 0) && 413 if ((name_len > 0) && ('\0' != name[name_len - 1]))
432 ('\0' != name[name_len -1]) )
433 { 414 {
434 GNUNET_break (0); 415 GNUNET_break (0);
435 return GNUNET_SYSERR; 416 return GNUNET_SYSERR;
@@ -443,9 +424,7 @@ check_lookup_result (void *cls,
443 } 424 }
444 return GNUNET_OK; 425 return GNUNET_OK;
445 } 426 }
446 return check_rd (rd_len, 427 return check_rd (rd_len, &name[name_len], ntohs (msg->rd_count));
447 &name[name_len],
448 ntohs (msg->rd_count));
449} 428}
450 429
451 430
@@ -457,8 +436,7 @@ check_lookup_result (void *cls,
457 * @param msg the message we received 436 * @param msg the message we received
458 */ 437 */
459static void 438static void
460handle_lookup_result (void *cls, 439handle_lookup_result (void *cls, const struct LabelLookupResponseMessage *msg)
461 const struct LabelLookupResponseMessage *msg)
462{ 440{
463 struct GNUNET_NAMESTORE_Handle *h = cls; 441 struct GNUNET_NAMESTORE_Handle *h = cls;
464 struct GNUNET_NAMESTORE_QueueEntry *qe; 442 struct GNUNET_NAMESTORE_QueueEntry *qe;
@@ -468,10 +446,8 @@ handle_lookup_result (void *cls,
468 size_t rd_len; 446 size_t rd_len;
469 unsigned int rd_count; 447 unsigned int rd_count;
470 448
471 LOG (GNUNET_ERROR_TYPE_DEBUG, 449 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received RECORD_LOOKUP_RESULT\n");
472 "Received RECORD_LOOKUP_RESULT\n"); 450 qe = find_qe (h, ntohl (msg->gns_header.r_id));
473 qe = find_qe (h,
474 ntohl (msg->gns_header.r_id));
475 if (NULL == qe) 451 if (NULL == qe)
476 return; 452 return;
477 rd_len = ntohs (msg->rd_len); 453 rd_len = ntohs (msg->rd_len);
@@ -482,11 +458,7 @@ handle_lookup_result (void *cls,
482 { 458 {
483 /* label was not in namestore */ 459 /* label was not in namestore */
484 if (NULL != qe->proc) 460 if (NULL != qe->proc)
485 qe->proc (qe->proc_cls, 461 qe->proc (qe->proc_cls, &msg->private_key, name, 0, NULL);
486 &msg->private_key,
487 name,
488 0,
489 NULL);
490 free_qe (qe); 462 free_qe (qe);
491 return; 463 return;
492 } 464 }
@@ -495,11 +467,9 @@ handle_lookup_result (void *cls,
495 { 467 {
496 struct GNUNET_GNSRECORD_Data rd[rd_count]; 468 struct GNUNET_GNSRECORD_Data rd[rd_count];
497 469
498 GNUNET_assert (GNUNET_OK == 470 GNUNET_assert (
499 GNUNET_GNSRECORD_records_deserialize (rd_len, 471 GNUNET_OK ==
500 rd_tmp, 472 GNUNET_GNSRECORD_records_deserialize (rd_len, rd_tmp, rd_count, rd));
501 rd_count,
502 rd));
503 if (0 == name_len) 473 if (0 == name_len)
504 name = NULL; 474 name = NULL;
505 if (NULL != qe->proc) 475 if (NULL != qe->proc)
@@ -522,8 +492,7 @@ handle_lookup_result (void *cls,
522 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 492 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
523 */ 493 */
524static int 494static int
525check_record_result (void *cls, 495check_record_result (void *cls, const struct RecordResultMessage *msg)
526 const struct RecordResultMessage *msg)
527{ 496{
528 static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy; 497 static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy;
529 const char *name; 498 const char *name;
@@ -546,21 +515,17 @@ check_record_result (void *cls,
546 return GNUNET_SYSERR; 515 return GNUNET_SYSERR;
547 } 516 }
548 name = (const char *) &msg[1]; 517 name = (const char *) &msg[1];
549 if ( (0 == name_len) || 518 if ((0 == name_len) || ('\0' != name[name_len - 1]))
550 ('\0' != name[name_len -1]) )
551 { 519 {
552 GNUNET_break (0); 520 GNUNET_break (0);
553 return GNUNET_SYSERR; 521 return GNUNET_SYSERR;
554 } 522 }
555 if (0 == GNUNET_memcmp (&msg->private_key, 523 if (0 == GNUNET_memcmp (&msg->private_key, &priv_dummy))
556 &priv_dummy) )
557 { 524 {
558 GNUNET_break (0); 525 GNUNET_break (0);
559 return GNUNET_SYSERR; 526 return GNUNET_SYSERR;
560 } 527 }
561 return check_rd (rd_len, 528 return check_rd (rd_len, &name[name_len], ntohs (msg->rd_count));
562 &name[name_len],
563 ntohs (msg->rd_count));
564} 529}
565 530
566 531
@@ -572,8 +537,7 @@ check_record_result (void *cls,
572 * @param msg the message we received 537 * @param msg the message we received
573 */ 538 */
574static void 539static void
575handle_record_result (void *cls, 540handle_record_result (void *cls, const struct RecordResultMessage *msg)
576 const struct RecordResultMessage *msg)
577{ 541{
578 struct GNUNET_NAMESTORE_Handle *h = cls; 542 struct GNUNET_NAMESTORE_Handle *h = cls;
579 struct GNUNET_NAMESTORE_QueueEntry *qe; 543 struct GNUNET_NAMESTORE_QueueEntry *qe;
@@ -584,22 +548,17 @@ handle_record_result (void *cls,
584 size_t rd_len; 548 size_t rd_len;
585 unsigned int rd_count; 549 unsigned int rd_count;
586 550
587 LOG (GNUNET_ERROR_TYPE_DEBUG, 551 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received RECORD_RESULT\n");
588 "Received RECORD_RESULT\n");
589 rd_len = ntohs (msg->rd_len); 552 rd_len = ntohs (msg->rd_len);
590 rd_count = ntohs (msg->rd_count); 553 rd_count = ntohs (msg->rd_count);
591 name_len = ntohs (msg->name_len); 554 name_len = ntohs (msg->name_len);
592 ze = find_zi (h, 555 ze = find_zi (h, ntohl (msg->gns_header.r_id));
593 ntohl (msg->gns_header.r_id)); 556 qe = find_qe (h, ntohl (msg->gns_header.r_id));
594 qe = find_qe (h, 557 if ((NULL == ze) && (NULL == qe))
595 ntohl (msg->gns_header.r_id));
596 if ( (NULL == ze) &&
597 (NULL == qe) )
598 return; /* rid not found */ 558 return; /* rid not found */
599 if ( (NULL != ze) && 559 if ((NULL != ze) && (NULL != qe))
600 (NULL != qe) )
601 { 560 {
602 GNUNET_break (0); /* rid ambigous */ 561 GNUNET_break (0); /* rid ambigous */
603 force_reconnect (h); 562 force_reconnect (h);
604 return; 563 return;
605 } 564 }
@@ -608,11 +567,9 @@ handle_record_result (void *cls,
608 { 567 {
609 struct GNUNET_GNSRECORD_Data rd[rd_count]; 568 struct GNUNET_GNSRECORD_Data rd[rd_count];
610 569
611 GNUNET_assert (GNUNET_OK == 570 GNUNET_assert (
612 GNUNET_GNSRECORD_records_deserialize(rd_len, 571 GNUNET_OK ==
613 rd_tmp, 572 GNUNET_GNSRECORD_records_deserialize (rd_len, rd_tmp, rd_count, rd));
614 rd_count,
615 rd));
616 if (0 == name_len) 573 if (0 == name_len)
617 name = NULL; 574 name = NULL;
618 if (NULL != qe) 575 if (NULL != qe)
@@ -629,11 +586,7 @@ handle_record_result (void *cls,
629 if (NULL != ze) 586 if (NULL != ze)
630 { 587 {
631 if (NULL != ze->proc) 588 if (NULL != ze->proc)
632 ze->proc (ze->proc_cls, 589 ze->proc (ze->proc_cls, &msg->private_key, name, rd_count, rd);
633 &msg->private_key,
634 name,
635 rd_count,
636 rd);
637 return; 590 return;
638 } 591 }
639 } 592 }
@@ -649,31 +602,24 @@ handle_record_result (void *cls,
649 * @param msg the message we received 602 * @param msg the message we received
650 */ 603 */
651static void 604static void
652handle_record_result_end (void *cls, 605handle_record_result_end (void *cls, const struct GNUNET_NAMESTORE_Header *msg)
653 const struct GNUNET_NAMESTORE_Header *msg)
654{ 606{
655 struct GNUNET_NAMESTORE_Handle *h = cls; 607 struct GNUNET_NAMESTORE_Handle *h = cls;
656 struct GNUNET_NAMESTORE_QueueEntry *qe; 608 struct GNUNET_NAMESTORE_QueueEntry *qe;
657 struct GNUNET_NAMESTORE_ZoneIterator *ze; 609 struct GNUNET_NAMESTORE_ZoneIterator *ze;
658 610
659 LOG (GNUNET_ERROR_TYPE_DEBUG, 611 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received RECORD_RESULT_END\n");
660 "Received RECORD_RESULT_END\n"); 612 ze = find_zi (h, ntohl (msg->r_id));
661 ze = find_zi (h, 613 qe = find_qe (h, ntohl (msg->r_id));
662 ntohl (msg->r_id)); 614 if ((NULL == ze) && (NULL == qe))
663 qe = find_qe (h,
664 ntohl (msg->r_id));
665 if ( (NULL == ze) &&
666 (NULL == qe) )
667 return; /* rid not found */ 615 return; /* rid not found */
668 if ( (NULL != ze) && 616 if ((NULL != ze) && (NULL != qe))
669 (NULL != qe) )
670 { 617 {
671 GNUNET_break (0); /* rid ambigous */ 618 GNUNET_break (0); /* rid ambigous */
672 force_reconnect (h); 619 force_reconnect (h);
673 return; 620 return;
674 } 621 }
675 LOG (GNUNET_ERROR_TYPE_DEBUG, 622 LOG (GNUNET_ERROR_TYPE_DEBUG, "Zone iteration completed!\n");
676 "Zone iteration completed!\n");
677 if (NULL == ze) 623 if (NULL == ze)
678 { 624 {
679 GNUNET_break (0); 625 GNUNET_break (0);
@@ -714,15 +660,12 @@ check_zone_to_name_response (void *cls,
714 return GNUNET_SYSERR; 660 return GNUNET_SYSERR;
715 } 661 }
716 name_tmp = (const char *) &msg[1]; 662 name_tmp = (const char *) &msg[1];
717 if ( (name_len > 0) && 663 if ((name_len > 0) && ('\0' != name_tmp[name_len - 1]))
718 ('\0' != name_tmp[name_len -1]) )
719 { 664 {
720 GNUNET_break (0); 665 GNUNET_break (0);
721 return GNUNET_SYSERR; 666 return GNUNET_SYSERR;
722 } 667 }
723 return check_rd (rd_ser_len, 668 return check_rd (rd_ser_len, &name_tmp[name_len], ntohs (msg->rd_count));
724 &name_tmp[name_len],
725 ntohs (msg->rd_count));
726} 669}
727 670
728 671
@@ -735,7 +678,7 @@ check_zone_to_name_response (void *cls,
735 */ 678 */
736static void 679static void
737handle_zone_to_name_response (void *cls, 680handle_zone_to_name_response (void *cls,
738 const struct ZoneToNameResponseMessage *msg) 681 const struct ZoneToNameResponseMessage *msg)
739{ 682{
740 struct GNUNET_NAMESTORE_Handle *h = cls; 683 struct GNUNET_NAMESTORE_Handle *h = cls;
741 struct GNUNET_NAMESTORE_QueueEntry *qe; 684 struct GNUNET_NAMESTORE_QueueEntry *qe;
@@ -746,27 +689,25 @@ handle_zone_to_name_response (void *cls,
746 const char *name_tmp; 689 const char *name_tmp;
747 const char *rd_tmp; 690 const char *rd_tmp;
748 691
749 LOG (GNUNET_ERROR_TYPE_DEBUG, 692 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME_RESPONSE\n");
750 "Received ZONE_TO_NAME_RESPONSE\n"); 693 qe = find_qe (h, ntohl (msg->gns_header.r_id));
751 qe = find_qe (h,
752 ntohl (msg->gns_header.r_id));
753 res = ntohs (msg->res); 694 res = ntohs (msg->res);
754 switch (res) 695 switch (res)
755 { 696 {
756 case GNUNET_SYSERR: 697 case GNUNET_SYSERR:
757 LOG (GNUNET_ERROR_TYPE_DEBUG, 698 LOG (GNUNET_ERROR_TYPE_DEBUG,
758 "An error occurred during zone to name operation\n"); 699 "An error occurred during zone to name operation\n");
759 break; 700 break;
760 case GNUNET_NO: 701 case GNUNET_NO:
761 LOG (GNUNET_ERROR_TYPE_DEBUG, 702 LOG (GNUNET_ERROR_TYPE_DEBUG,
762 "Namestore has no result for zone to name mapping \n"); 703 "Namestore has no result for zone to name mapping \n");
763 if (NULL != qe->proc) 704 if (NULL != qe->proc)
764 qe->proc (qe->proc_cls, &msg->zone, NULL, 0, NULL); 705 qe->proc (qe->proc_cls, &msg->zone, NULL, 0, NULL);
765 free_qe (qe); 706 free_qe (qe);
766 return; 707 return;
767 case GNUNET_YES: 708 case GNUNET_YES:
768 LOG (GNUNET_ERROR_TYPE_DEBUG, 709 LOG (GNUNET_ERROR_TYPE_DEBUG,
769 "Namestore has result for zone to name mapping \n"); 710 "Namestore has result for zone to name mapping \n");
770 name_len = ntohs (msg->name_len); 711 name_len = ntohs (msg->name_len);
771 rd_count = ntohs (msg->rd_count); 712 rd_count = ntohs (msg->rd_count);
772 rd_ser_len = ntohs (msg->rd_len); 713 rd_ser_len = ntohs (msg->rd_len);
@@ -782,11 +723,7 @@ handle_zone_to_name_response (void *cls,
782 rd)); 723 rd));
783 /* normal end, call continuation with result */ 724 /* normal end, call continuation with result */
784 if (NULL != qe->proc) 725 if (NULL != qe->proc)
785 qe->proc (qe->proc_cls, 726 qe->proc (qe->proc_cls, &msg->zone, name_tmp, rd_count, rd);
786 &msg->zone,
787 name_tmp,
788 rd_count,
789 rd);
790 /* return is important here: break would call continuation with error! */ 727 /* return is important here: break would call continuation with error! */
791 free_qe (qe); 728 free_qe (qe);
792 return; 729 return;
@@ -803,7 +740,6 @@ handle_zone_to_name_response (void *cls,
803} 740}
804 741
805 742
806
807/** 743/**
808 * Generic error handler, called with the appropriate error code and 744 * Generic error handler, called with the appropriate error code and
809 * the same closure specified at the creation of the message queue. 745 * the same closure specified at the creation of the message queue.
@@ -813,8 +749,7 @@ handle_zone_to_name_response (void *cls,
813 * @param error error code 749 * @param error error code
814 */ 750 */
815static void 751static void
816mq_error_handler (void *cls, 752mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
817 enum GNUNET_MQ_Error error)
818{ 753{
819 struct GNUNET_NAMESTORE_Handle *h = cls; 754 struct GNUNET_NAMESTORE_Handle *h = cls;
820 755
@@ -831,51 +766,45 @@ mq_error_handler (void *cls,
831static void 766static void
832reconnect (struct GNUNET_NAMESTORE_Handle *h) 767reconnect (struct GNUNET_NAMESTORE_Handle *h)
833{ 768{
834 struct GNUNET_MQ_MessageHandler handlers[] = { 769 struct GNUNET_MQ_MessageHandler handlers[] =
835 GNUNET_MQ_hd_fixed_size (record_store_response, 770 {GNUNET_MQ_hd_fixed_size (record_store_response,
836 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE, 771 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE,
837 struct RecordStoreResponseMessage, 772 struct RecordStoreResponseMessage,
838 h), 773 h),
839 GNUNET_MQ_hd_var_size (zone_to_name_response, 774 GNUNET_MQ_hd_var_size (zone_to_name_response,
840 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE, 775 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE,
841 struct ZoneToNameResponseMessage, 776 struct ZoneToNameResponseMessage,
842 h), 777 h),
843 GNUNET_MQ_hd_var_size (record_result, 778 GNUNET_MQ_hd_var_size (record_result,
844 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT, 779 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT,
845 struct RecordResultMessage, 780 struct RecordResultMessage,
846 h), 781 h),
847 GNUNET_MQ_hd_fixed_size (record_result_end, 782 GNUNET_MQ_hd_fixed_size (record_result_end,
848 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END, 783 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END,
849 struct GNUNET_NAMESTORE_Header, 784 struct GNUNET_NAMESTORE_Header,
850 h), 785 h),
851 GNUNET_MQ_hd_var_size (lookup_result, 786 GNUNET_MQ_hd_var_size (lookup_result,
852 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE, 787 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE,
853 struct LabelLookupResponseMessage, 788 struct LabelLookupResponseMessage,
854 h), 789 h),
855 GNUNET_MQ_handler_end () 790 GNUNET_MQ_handler_end ()};
856 };
857 struct GNUNET_NAMESTORE_ZoneIterator *it; 791 struct GNUNET_NAMESTORE_ZoneIterator *it;
858 struct GNUNET_NAMESTORE_QueueEntry *qe; 792 struct GNUNET_NAMESTORE_QueueEntry *qe;
859 793
860 GNUNET_assert (NULL == h->mq); 794 GNUNET_assert (NULL == h->mq);
861 h->mq = GNUNET_CLIENT_connect (h->cfg, 795 h->mq =
862 "namestore", 796 GNUNET_CLIENT_connect (h->cfg, "namestore", handlers, &mq_error_handler, h);
863 handlers,
864 &mq_error_handler,
865 h);
866 if (NULL == h->mq) 797 if (NULL == h->mq)
867 return; 798 return;
868 /* re-transmit pending requests that waited for a reconnect... */ 799 /* re-transmit pending requests that waited for a reconnect... */
869 for (it = h->z_head; NULL != it; it = it->next) 800 for (it = h->z_head; NULL != it; it = it->next)
870 { 801 {
871 GNUNET_MQ_send (h->mq, 802 GNUNET_MQ_send (h->mq, it->env);
872 it->env);
873 it->env = NULL; 803 it->env = NULL;
874 } 804 }
875 for (qe = h->op_head; NULL != qe; qe = qe->next) 805 for (qe = h->op_head; NULL != qe; qe = qe->next)
876 { 806 {
877 GNUNET_MQ_send (h->mq, 807 GNUNET_MQ_send (h->mq, qe->env);
878 qe->env);
879 qe->env = NULL; 808 qe->env = NULL;
880 } 809 }
881} 810}
@@ -926,12 +855,10 @@ force_reconnect (struct GNUNET_NAMESTORE_Handle *h)
926 free_qe (qe); 855 free_qe (qe);
927 } 856 }
928 857
929 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 858 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting to namestore\n");
930 "Reconnecting to namestore\n");
931 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); 859 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
932 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, 860 h->reconnect_task =
933 &reconnect_task, 861 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect_task, h);
934 h);
935} 862}
936 863
937 864
@@ -983,22 +910,17 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h)
983 struct GNUNET_NAMESTORE_QueueEntry *q; 910 struct GNUNET_NAMESTORE_QueueEntry *q;
984 struct GNUNET_NAMESTORE_ZoneIterator *z; 911 struct GNUNET_NAMESTORE_ZoneIterator *z;
985 912
986 LOG (GNUNET_ERROR_TYPE_DEBUG, 913 LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
987 "Cleaning up\n");
988 GNUNET_break (NULL == h->op_head); 914 GNUNET_break (NULL == h->op_head);
989 while (NULL != (q = h->op_head)) 915 while (NULL != (q = h->op_head))
990 { 916 {
991 GNUNET_CONTAINER_DLL_remove (h->op_head, 917 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, q);
992 h->op_tail,
993 q);
994 GNUNET_free (q); 918 GNUNET_free (q);
995 } 919 }
996 GNUNET_break (NULL == h->z_head); 920 GNUNET_break (NULL == h->z_head);
997 while (NULL != (z = h->z_head)) 921 while (NULL != (z = h->z_head))
998 { 922 {
999 GNUNET_CONTAINER_DLL_remove (h->z_head, 923 GNUNET_CONTAINER_DLL_remove (h->z_head, h->z_tail, z);
1000 h->z_tail,
1001 z);
1002 GNUNET_free (z); 924 GNUNET_free (z);
1003 } 925 }
1004 if (NULL != h->mq) 926 if (NULL != h->mq)
@@ -1033,9 +955,7 @@ warn_delay (void *cls)
1033 GNUNET_YES)); 955 GNUNET_YES));
1034 if (NULL != qe->cont) 956 if (NULL != qe->cont)
1035 { 957 {
1036 qe->cont (qe->cont_cls, 958 qe->cont (qe->cont_cls, GNUNET_SYSERR, "timeout");
1037 GNUNET_SYSERR,
1038 "timeout");
1039 qe->cont = NULL; 959 qe->cont = NULL;
1040 } 960 }
1041 GNUNET_NAMESTORE_cancel (qe); 961 GNUNET_NAMESTORE_cancel (qe);
@@ -1057,13 +977,14 @@ warn_delay (void *cls)
1057 * @return handle to abort the request 977 * @return handle to abort the request
1058 */ 978 */
1059struct GNUNET_NAMESTORE_QueueEntry * 979struct GNUNET_NAMESTORE_QueueEntry *
1060GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, 980GNUNET_NAMESTORE_records_store (
1061 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 981 struct GNUNET_NAMESTORE_Handle *h,
1062 const char *label, 982 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1063 unsigned int rd_count, 983 const char *label,
1064 const struct GNUNET_GNSRECORD_Data *rd, 984 unsigned int rd_count,
1065 GNUNET_NAMESTORE_ContinuationWithStatus cont, 985 const struct GNUNET_GNSRECORD_Data *rd,
1066 void *cont_cls) 986 GNUNET_NAMESTORE_ContinuationWithStatus cont,
987 void *cont_cls)
1067{ 988{
1068 struct GNUNET_NAMESTORE_QueueEntry *qe; 989 struct GNUNET_NAMESTORE_QueueEntry *qe;
1069 struct GNUNET_MQ_Envelope *env; 990 struct GNUNET_MQ_Envelope *env;
@@ -1081,8 +1002,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1081 GNUNET_break (0); 1002 GNUNET_break (0);
1082 return NULL; 1003 return NULL;
1083 } 1004 }
1084 rd_ser_len = GNUNET_GNSRECORD_records_get_size (rd_count, 1005 rd_ser_len = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1085 rd);
1086 if (rd_ser_len < 0) 1006 if (rd_ser_len < 0)
1087 { 1007 {
1088 GNUNET_break (0); 1008 GNUNET_break (0);
@@ -1099,9 +1019,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1099 qe->cont = cont; 1019 qe->cont = cont;
1100 qe->cont_cls = cont_cls; 1020 qe->cont_cls = cont_cls;
1101 qe->op_id = rid; 1021 qe->op_id = rid;
1102 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, 1022 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
1103 h->op_tail,
1104 qe);
1105 1023
1106 /* setup msg */ 1024 /* setup msg */
1107 env = GNUNET_MQ_msg_extra (msg, 1025 env = GNUNET_MQ_msg_extra (msg,
@@ -1115,29 +1033,22 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1115 msg->private_key = *pkey; 1033 msg->private_key = *pkey;
1116 1034
1117 name_tmp = (char *) &msg[1]; 1035 name_tmp = (char *) &msg[1];
1118 GNUNET_memcpy (name_tmp, 1036 GNUNET_memcpy (name_tmp, label, name_len);
1119 label,
1120 name_len);
1121 rd_ser = &name_tmp[name_len]; 1037 rd_ser = &name_tmp[name_len];
1122 sret = GNUNET_GNSRECORD_records_serialize (rd_count, 1038 sret = GNUNET_GNSRECORD_records_serialize (rd_count, rd, rd_ser_len, rd_ser);
1123 rd, 1039 if ((0 > sret) || (sret != rd_ser_len))
1124 rd_ser_len,
1125 rd_ser);
1126 if ( (0 > sret) ||
1127 (sret != rd_ser_len) )
1128 { 1040 {
1129 GNUNET_break (0); 1041 GNUNET_break (0);
1130 GNUNET_free (env); 1042 GNUNET_free (env);
1131 return NULL; 1043 return NULL;
1132 } 1044 }
1133 GNUNET_assert (rd_ser_len == (size_t) sret); 1045 GNUNET_assert (rd_ser_len == sret);
1134 LOG (GNUNET_ERROR_TYPE_DEBUG, 1046 LOG (GNUNET_ERROR_TYPE_DEBUG,
1135 "Sending NAMESTORE_RECORD_STORE message for name `%s' with %u records\n", 1047 "Sending NAMESTORE_RECORD_STORE message for name `%s' with %u records\n",
1136 label, 1048 label,
1137 rd_count); 1049 rd_count);
1138 qe->timeout_task = GNUNET_SCHEDULER_add_delayed (NAMESTORE_DELAY_TOLERANCE, 1050 qe->timeout_task =
1139 &warn_delay, 1051 GNUNET_SCHEDULER_add_delayed (NAMESTORE_DELAY_TOLERANCE, &warn_delay, qe);
1140 qe);
1141 if (NULL == h->mq) 1052 if (NULL == h->mq)
1142 { 1053 {
1143 qe->env = env; 1054 qe->env = env;
@@ -1146,8 +1057,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1146 } 1057 }
1147 else 1058 else
1148 { 1059 {
1149 GNUNET_MQ_send (h->mq, 1060 GNUNET_MQ_send (h->mq, env);
1150 env);
1151 } 1061 }
1152 return qe; 1062 return qe;
1153} 1063}
@@ -1176,7 +1086,7 @@ GNUNET_NAMESTORE_set_nick (struct GNUNET_NAMESTORE_Handle *h,
1176 return NULL; 1086 return NULL;
1177 memset (&rd, 0, sizeof (rd)); 1087 memset (&rd, 0, sizeof (rd));
1178 rd.data = nick; 1088 rd.data = nick;
1179 rd.data_size = strlen (nick) +1; 1089 rd.data_size = strlen (nick) + 1;
1180 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK; 1090 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
1181 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 1091 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
1182 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE; 1092 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
@@ -1203,13 +1113,14 @@ GNUNET_NAMESTORE_set_nick (struct GNUNET_NAMESTORE_Handle *h,
1203 * @return handle to abort the request 1113 * @return handle to abort the request
1204 */ 1114 */
1205struct GNUNET_NAMESTORE_QueueEntry * 1115struct GNUNET_NAMESTORE_QueueEntry *
1206GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, 1116GNUNET_NAMESTORE_records_lookup (
1207 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 1117 struct GNUNET_NAMESTORE_Handle *h,
1208 const char *label, 1118 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
1209 GNUNET_SCHEDULER_TaskCallback error_cb, 1119 const char *label,
1210 void *error_cb_cls, 1120 GNUNET_SCHEDULER_TaskCallback error_cb,
1211 GNUNET_NAMESTORE_RecordMonitor rm, 1121 void *error_cb_cls,
1212 void *rm_cls) 1122 GNUNET_NAMESTORE_RecordMonitor rm,
1123 void *rm_cls)
1213{ 1124{
1214 struct GNUNET_NAMESTORE_QueueEntry *qe; 1125 struct GNUNET_NAMESTORE_QueueEntry *qe;
1215 struct GNUNET_MQ_Envelope *env; 1126 struct GNUNET_MQ_Envelope *env;
@@ -1228,10 +1139,8 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
1228 qe->error_cb_cls = error_cb_cls; 1139 qe->error_cb_cls = error_cb_cls;
1229 qe->proc = rm; 1140 qe->proc = rm;
1230 qe->proc_cls = rm_cls; 1141 qe->proc_cls = rm_cls;
1231 qe->op_id = get_op_id(h); 1142 qe->op_id = get_op_id (h);
1232 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, 1143 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
1233 h->op_tail,
1234 qe);
1235 1144
1236 env = GNUNET_MQ_msg_extra (msg, 1145 env = GNUNET_MQ_msg_extra (msg,
1237 label_len, 1146 label_len,
@@ -1239,14 +1148,11 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
1239 msg->gns_header.r_id = htonl (qe->op_id); 1148 msg->gns_header.r_id = htonl (qe->op_id);
1240 msg->zone = *pkey; 1149 msg->zone = *pkey;
1241 msg->label_len = htonl (label_len); 1150 msg->label_len = htonl (label_len);
1242 GNUNET_memcpy (&msg[1], 1151 GNUNET_memcpy (&msg[1], label, label_len);
1243 label,
1244 label_len);
1245 if (NULL == h->mq) 1152 if (NULL == h->mq)
1246 qe->env = env; 1153 qe->env = env;
1247 else 1154 else
1248 GNUNET_MQ_send (h->mq, 1155 GNUNET_MQ_send (h->mq, env);
1249 env);
1250 return qe; 1156 return qe;
1251} 1157}
1252 1158
@@ -1267,20 +1173,21 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
1267 * cancel 1173 * cancel
1268 */ 1174 */
1269struct GNUNET_NAMESTORE_QueueEntry * 1175struct GNUNET_NAMESTORE_QueueEntry *
1270GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, 1176GNUNET_NAMESTORE_zone_to_name (
1271 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1177 struct GNUNET_NAMESTORE_Handle *h,
1272 const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, 1178 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1273 GNUNET_SCHEDULER_TaskCallback error_cb, 1179 const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone,
1274 void *error_cb_cls, 1180 GNUNET_SCHEDULER_TaskCallback error_cb,
1275 GNUNET_NAMESTORE_RecordMonitor proc, 1181 void *error_cb_cls,
1276 void *proc_cls) 1182 GNUNET_NAMESTORE_RecordMonitor proc,
1183 void *proc_cls)
1277{ 1184{
1278 struct GNUNET_NAMESTORE_QueueEntry *qe; 1185 struct GNUNET_NAMESTORE_QueueEntry *qe;
1279 struct GNUNET_MQ_Envelope *env; 1186 struct GNUNET_MQ_Envelope *env;
1280 struct ZoneToNameMessage *msg; 1187 struct ZoneToNameMessage *msg;
1281 uint32_t rid; 1188 uint32_t rid;
1282 1189
1283 rid = get_op_id(h); 1190 rid = get_op_id (h);
1284 qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry); 1191 qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry);
1285 qe->h = h; 1192 qe->h = h;
1286 qe->error_cb = error_cb; 1193 qe->error_cb = error_cb;
@@ -1288,20 +1195,16 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
1288 qe->proc = proc; 1195 qe->proc = proc;
1289 qe->proc_cls = proc_cls; 1196 qe->proc_cls = proc_cls;
1290 qe->op_id = rid; 1197 qe->op_id = rid;
1291 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, 1198 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, qe);
1292 h->op_tail,
1293 qe);
1294 1199
1295 env = GNUNET_MQ_msg (msg, 1200 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME);
1296 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME);
1297 msg->gns_header.r_id = htonl (rid); 1201 msg->gns_header.r_id = htonl (rid);
1298 msg->zone = *zone; 1202 msg->zone = *zone;
1299 msg->value_zone = *value_zone; 1203 msg->value_zone = *value_zone;
1300 if (NULL == h->mq) 1204 if (NULL == h->mq)
1301 qe->env = env; 1205 qe->env = env;
1302 else 1206 else
1303 GNUNET_MQ_send (h->mq, 1207 GNUNET_MQ_send (h->mq, env);
1304 env);
1305 return qe; 1208 return qe;
1306} 1209}
1307 1210
@@ -1326,22 +1229,22 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
1326 * @return an iterator handle to use for iteration 1229 * @return an iterator handle to use for iteration
1327 */ 1230 */
1328struct GNUNET_NAMESTORE_ZoneIterator * 1231struct GNUNET_NAMESTORE_ZoneIterator *
1329GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, 1232GNUNET_NAMESTORE_zone_iteration_start (
1330 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1233 struct GNUNET_NAMESTORE_Handle *h,
1331 GNUNET_SCHEDULER_TaskCallback error_cb, 1234 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1332 void *error_cb_cls, 1235 GNUNET_SCHEDULER_TaskCallback error_cb,
1333 GNUNET_NAMESTORE_RecordMonitor proc, 1236 void *error_cb_cls,
1334 void *proc_cls, 1237 GNUNET_NAMESTORE_RecordMonitor proc,
1335 GNUNET_SCHEDULER_TaskCallback finish_cb, 1238 void *proc_cls,
1336 void *finish_cb_cls) 1239 GNUNET_SCHEDULER_TaskCallback finish_cb,
1240 void *finish_cb_cls)
1337{ 1241{
1338 struct GNUNET_NAMESTORE_ZoneIterator *it; 1242 struct GNUNET_NAMESTORE_ZoneIterator *it;
1339 struct GNUNET_MQ_Envelope *env; 1243 struct GNUNET_MQ_Envelope *env;
1340 struct ZoneIterationStartMessage *msg; 1244 struct ZoneIterationStartMessage *msg;
1341 uint32_t rid; 1245 uint32_t rid;
1342 1246
1343 LOG (GNUNET_ERROR_TYPE_DEBUG, 1247 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ZONE_ITERATION_START message\n");
1344 "Sending ZONE_ITERATION_START message\n");
1345 rid = get_op_id (h); 1248 rid = get_op_id (h);
1346 it = GNUNET_new (struct GNUNET_NAMESTORE_ZoneIterator); 1249 it = GNUNET_new (struct GNUNET_NAMESTORE_ZoneIterator);
1347 it->h = h; 1250 it->h = h;
@@ -1354,19 +1257,15 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
1354 it->op_id = rid; 1257 it->op_id = rid;
1355 if (NULL != zone) 1258 if (NULL != zone)
1356 it->zone = *zone; 1259 it->zone = *zone;
1357 GNUNET_CONTAINER_DLL_insert_tail (h->z_head, 1260 GNUNET_CONTAINER_DLL_insert_tail (h->z_head, h->z_tail, it);
1358 h->z_tail, 1261 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START);
1359 it);
1360 env = GNUNET_MQ_msg (msg,
1361 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START);
1362 msg->gns_header.r_id = htonl (rid); 1262 msg->gns_header.r_id = htonl (rid);
1363 if (NULL != zone) 1263 if (NULL != zone)
1364 msg->zone = *zone; 1264 msg->zone = *zone;
1365 if (NULL == h->mq) 1265 if (NULL == h->mq)
1366 it->env = env; 1266 it->env = env;
1367 else 1267 else
1368 GNUNET_MQ_send (h->mq, 1268 GNUNET_MQ_send (h->mq, env);
1369 env);
1370 return it; 1269 return it;
1371} 1270}
1372 1271
@@ -1390,12 +1289,10 @@ GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it,
1390 LOG (GNUNET_ERROR_TYPE_DEBUG, 1289 LOG (GNUNET_ERROR_TYPE_DEBUG,
1391 "Sending ZONE_ITERATION_NEXT message with limit %llu\n", 1290 "Sending ZONE_ITERATION_NEXT message with limit %llu\n",
1392 (unsigned long long) limit); 1291 (unsigned long long) limit);
1393 env = GNUNET_MQ_msg (msg, 1292 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT);
1394 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT);
1395 msg->gns_header.r_id = htonl (it->op_id); 1293 msg->gns_header.r_id = htonl (it->op_id);
1396 msg->limit = GNUNET_htonll (limit); 1294 msg->limit = GNUNET_htonll (limit);
1397 GNUNET_MQ_send (h->mq, 1295 GNUNET_MQ_send (h->mq, env);
1398 env);
1399} 1296}
1400 1297
1401 1298
@@ -1411,15 +1308,13 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it)
1411 struct GNUNET_MQ_Envelope *env; 1308 struct GNUNET_MQ_Envelope *env;
1412 struct ZoneIterationStopMessage *msg; 1309 struct ZoneIterationStopMessage *msg;
1413 1310
1414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ZONE_ITERATION_STOP message\n");
1415 "Sending ZONE_ITERATION_STOP message\n");
1416 if (NULL != h->mq) 1312 if (NULL != h->mq)
1417 { 1313 {
1418 env = GNUNET_MQ_msg (msg, 1314 env =
1419 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP); 1315 GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP);
1420 msg->gns_header.r_id = htonl (it->op_id); 1316 msg->gns_header.r_id = htonl (it->op_id);
1421 GNUNET_MQ_send (h->mq, 1317 GNUNET_MQ_send (h->mq, env);
1422 env);
1423 } 1318 }
1424 free_ze (it); 1319 free_ze (it);
1425} 1320}