diff options
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 1934 |
1 files changed, 961 insertions, 973 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 3a925b952..71754081e 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -16,7 +16,7 @@ | |||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file namestore/gnunet-service-namestore.c | 22 | * @file namestore/gnunet-service-namestore.c |
@@ -36,7 +36,7 @@ | |||
36 | #include "namestore.h" | 36 | #include "namestore.h" |
37 | 37 | ||
38 | #define LOG_STRERROR_FILE(kind, syscall, filename) \ | 38 | #define LOG_STRERROR_FILE(kind, syscall, filename) \ |
39 | GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 39 | GNUNET_log_from_strerror_file(kind, "util", syscall, filename) |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * If a monitor takes more than 1 minute to process an event, print a warning. | 42 | * If a monitor takes more than 1 minute to process an event, print a warning. |
@@ -57,8 +57,7 @@ struct NamestoreClient; | |||
57 | /** | 57 | /** |
58 | * A namestore iteration operation. | 58 | * A namestore iteration operation. |
59 | */ | 59 | */ |
60 | struct ZoneIteration | 60 | struct ZoneIteration { |
61 | { | ||
62 | /** | 61 | /** |
63 | * Next element in the DLL | 62 | * Next element in the DLL |
64 | */ | 63 | */ |
@@ -125,9 +124,7 @@ struct ZoneIteration | |||
125 | /** | 124 | /** |
126 | * A namestore client | 125 | * A namestore client |
127 | */ | 126 | */ |
128 | struct NamestoreClient | 127 | struct NamestoreClient { |
129 | { | ||
130 | |||
131 | /** | 128 | /** |
132 | * The client | 129 | * The client |
133 | */ | 130 | */ |
@@ -155,8 +152,7 @@ struct NamestoreClient | |||
155 | /** | 152 | /** |
156 | * A namestore monitor. | 153 | * A namestore monitor. |
157 | */ | 154 | */ |
158 | struct ZoneMonitor | 155 | struct ZoneMonitor { |
159 | { | ||
160 | /** | 156 | /** |
161 | * Next element in the DLL | 157 | * Next element in the DLL |
162 | */ | 158 | */ |
@@ -233,9 +229,7 @@ struct ZoneMonitor | |||
233 | /** | 229 | /** |
234 | * Pending operation on the namecache. | 230 | * Pending operation on the namecache. |
235 | */ | 231 | */ |
236 | struct CacheOperation | 232 | struct CacheOperation { |
237 | { | ||
238 | |||
239 | /** | 233 | /** |
240 | * Kept in a DLL. | 234 | * Kept in a DLL. |
241 | */ | 235 | */ |
@@ -273,8 +267,7 @@ struct CacheOperation | |||
273 | * Information for an ongoing #handle_record_store() operation. | 267 | * Information for an ongoing #handle_record_store() operation. |
274 | * Needed as we may wait for monitors to be ready for the notification. | 268 | * Needed as we may wait for monitors to be ready for the notification. |
275 | */ | 269 | */ |
276 | struct StoreActivity | 270 | struct StoreActivity { |
277 | { | ||
278 | /** | 271 | /** |
279 | * Kept in a DLL. | 272 | * Kept in a DLL. |
280 | */ | 273 | */ |
@@ -311,8 +304,7 @@ struct StoreActivity | |||
311 | /** | 304 | /** |
312 | * Entry in list of cached nick resolutions. | 305 | * Entry in list of cached nick resolutions. |
313 | */ | 306 | */ |
314 | struct NickCache | 307 | struct NickCache { |
315 | { | ||
316 | /** | 308 | /** |
317 | * Zone the cache entry is for. | 309 | * Zone the cache entry is for. |
318 | */ | 310 | */ |
@@ -419,38 +411,38 @@ static int disable_namecache; | |||
419 | * @param cls unused | 411 | * @param cls unused |
420 | */ | 412 | */ |
421 | static void | 413 | static void |
422 | cleanup_task (void *cls) | 414 | cleanup_task(void *cls) |
423 | { | 415 | { |
424 | struct CacheOperation *cop; | 416 | struct CacheOperation *cop; |
425 | 417 | ||
426 | (void) cls; | 418 | (void)cls; |
427 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n"); | 419 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n"); |
428 | while (NULL != (cop = cop_head)) | 420 | while (NULL != (cop = cop_head)) |
429 | { | 421 | { |
430 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 422 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
431 | "Aborting incomplete namecache operation\n"); | 423 | "Aborting incomplete namecache operation\n"); |
432 | GNUNET_NAMECACHE_cancel (cop->qe); | 424 | GNUNET_NAMECACHE_cancel(cop->qe); |
433 | GNUNET_CONTAINER_DLL_remove (cop_head, cop_tail, cop); | 425 | GNUNET_CONTAINER_DLL_remove(cop_head, cop_tail, cop); |
434 | GNUNET_free (cop); | 426 | GNUNET_free(cop); |
435 | } | 427 | } |
436 | if (NULL != namecache) | 428 | if (NULL != namecache) |
437 | { | 429 | { |
438 | GNUNET_NAMECACHE_disconnect (namecache); | 430 | GNUNET_NAMECACHE_disconnect(namecache); |
439 | namecache = NULL; | 431 | namecache = NULL; |
440 | } | 432 | } |
441 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, GSN_database)); | 433 | GNUNET_break(NULL == GNUNET_PLUGIN_unload(db_lib_name, GSN_database)); |
442 | GNUNET_free (db_lib_name); | 434 | GNUNET_free(db_lib_name); |
443 | db_lib_name = NULL; | 435 | db_lib_name = NULL; |
444 | if (NULL != monitor_nc) | 436 | if (NULL != monitor_nc) |
445 | { | 437 | { |
446 | GNUNET_notification_context_destroy (monitor_nc); | 438 | GNUNET_notification_context_destroy(monitor_nc); |
447 | monitor_nc = NULL; | 439 | monitor_nc = NULL; |
448 | } | 440 | } |
449 | if (NULL != statistics) | 441 | if (NULL != statistics) |
450 | { | 442 | { |
451 | GNUNET_STATISTICS_destroy (statistics, GNUNET_NO); | 443 | GNUNET_STATISTICS_destroy(statistics, GNUNET_NO); |
452 | statistics = NULL; | 444 | statistics = NULL; |
453 | } | 445 | } |
454 | } | 446 | } |
455 | 447 | ||
456 | 448 | ||
@@ -460,11 +452,11 @@ cleanup_task (void *cls) | |||
460 | * @param sa activity to free | 452 | * @param sa activity to free |
461 | */ | 453 | */ |
462 | static void | 454 | static void |
463 | free_store_activity (struct StoreActivity *sa) | 455 | free_store_activity(struct StoreActivity *sa) |
464 | { | 456 | { |
465 | GNUNET_CONTAINER_DLL_remove (sa_head, sa_tail, sa); | 457 | GNUNET_CONTAINER_DLL_remove(sa_head, sa_tail, sa); |
466 | GNUNET_free (sa->conv_name); | 458 | GNUNET_free(sa->conv_name); |
467 | GNUNET_free (sa); | 459 | GNUNET_free(sa); |
468 | } | 460 | } |
469 | 461 | ||
470 | 462 | ||
@@ -481,37 +473,37 @@ free_store_activity (struct StoreActivity *sa) | |||
481 | * @param rd records stored under @a label in the zone | 473 | * @param rd records stored under @a label in the zone |
482 | */ | 474 | */ |
483 | static void | 475 | static void |
484 | lookup_nick_it (void *cls, | 476 | lookup_nick_it(void *cls, |
485 | uint64_t seq, | 477 | uint64_t seq, |
486 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 478 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, |
487 | const char *label, | 479 | const char *label, |
488 | unsigned int rd_count, | 480 | unsigned int rd_count, |
489 | const struct GNUNET_GNSRECORD_Data *rd) | 481 | const struct GNUNET_GNSRECORD_Data *rd) |
490 | { | 482 | { |
491 | struct GNUNET_GNSRECORD_Data **res = cls; | 483 | struct GNUNET_GNSRECORD_Data **res = cls; |
492 | 484 | ||
493 | (void) private_key; | 485 | (void)private_key; |
494 | GNUNET_assert (0 != seq); | 486 | GNUNET_assert(0 != seq); |
495 | if (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT)) | 487 | if (0 != strcmp(label, GNUNET_GNS_EMPTY_LABEL_AT)) |
496 | { | ||
497 | GNUNET_break (0); | ||
498 | return; | ||
499 | } | ||
500 | for (unsigned int c = 0; c < rd_count; c++) | ||
501 | { | ||
502 | if (GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type) | ||
503 | { | 488 | { |
504 | (*res) = | 489 | GNUNET_break(0); |
505 | GNUNET_malloc (rd[c].data_size + sizeof (struct GNUNET_GNSRECORD_Data)); | ||
506 | (*res)->data = &(*res)[1]; | ||
507 | GNUNET_memcpy ((void *) (*res)->data, rd[c].data, rd[c].data_size); | ||
508 | (*res)->data_size = rd[c].data_size; | ||
509 | (*res)->expiration_time = rd[c].expiration_time; | ||
510 | (*res)->flags = rd[c].flags; | ||
511 | (*res)->record_type = GNUNET_GNSRECORD_TYPE_NICK; | ||
512 | return; | 490 | return; |
513 | } | 491 | } |
514 | } | 492 | for (unsigned int c = 0; c < rd_count; c++) |
493 | { | ||
494 | if (GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type) | ||
495 | { | ||
496 | (*res) = | ||
497 | GNUNET_malloc(rd[c].data_size + sizeof(struct GNUNET_GNSRECORD_Data)); | ||
498 | (*res)->data = &(*res)[1]; | ||
499 | GNUNET_memcpy((void *)(*res)->data, rd[c].data, rd[c].data_size); | ||
500 | (*res)->data_size = rd[c].data_size; | ||
501 | (*res)->expiration_time = rd[c].expiration_time; | ||
502 | (*res)->flags = rd[c].flags; | ||
503 | (*res)->record_type = GNUNET_GNSRECORD_TYPE_NICK; | ||
504 | return; | ||
505 | } | ||
506 | } | ||
515 | (*res) = NULL; | 507 | (*res) = NULL; |
516 | } | 508 | } |
517 | 509 | ||
@@ -523,39 +515,39 @@ lookup_nick_it (void *cls, | |||
523 | * @param nick nick entry to cache | 515 | * @param nick nick entry to cache |
524 | */ | 516 | */ |
525 | static void | 517 | static void |
526 | cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 518 | cache_nick(const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
527 | const struct GNUNET_GNSRECORD_Data *nick) | 519 | const struct GNUNET_GNSRECORD_Data *nick) |
528 | { | 520 | { |
529 | struct NickCache *oldest; | 521 | struct NickCache *oldest; |
530 | 522 | ||
531 | oldest = NULL; | 523 | oldest = NULL; |
532 | for (unsigned int i = 0; i < NC_SIZE; i++) | 524 | for (unsigned int i = 0; i < NC_SIZE; i++) |
533 | { | ||
534 | struct NickCache *pos = &nick_cache[i]; | ||
535 | |||
536 | if ((NULL == oldest) || | ||
537 | (oldest->last_used.abs_value_us > pos->last_used.abs_value_us)) | ||
538 | oldest = pos; | ||
539 | if (0 == GNUNET_memcmp (zone, &pos->zone)) | ||
540 | { | 525 | { |
541 | oldest = pos; | 526 | struct NickCache *pos = &nick_cache[i]; |
542 | break; | 527 | |
528 | if ((NULL == oldest) || | ||
529 | (oldest->last_used.abs_value_us > pos->last_used.abs_value_us)) | ||
530 | oldest = pos; | ||
531 | if (0 == GNUNET_memcmp(zone, &pos->zone)) | ||
532 | { | ||
533 | oldest = pos; | ||
534 | break; | ||
535 | } | ||
543 | } | 536 | } |
544 | } | 537 | GNUNET_free_non_null(oldest->rd); |
545 | GNUNET_free_non_null (oldest->rd); | ||
546 | oldest->zone = *zone; | 538 | oldest->zone = *zone; |
547 | if (NULL != nick) | 539 | if (NULL != nick) |
548 | { | 540 | { |
549 | oldest->rd = GNUNET_malloc (sizeof (*nick) + nick->data_size); | 541 | oldest->rd = GNUNET_malloc(sizeof(*nick) + nick->data_size); |
550 | *oldest->rd = *nick; | 542 | *oldest->rd = *nick; |
551 | oldest->rd->data = &oldest->rd[1]; | 543 | oldest->rd->data = &oldest->rd[1]; |
552 | memcpy (&oldest->rd[1], nick->data, nick->data_size); | 544 | memcpy(&oldest->rd[1], nick->data, nick->data_size); |
553 | } | 545 | } |
554 | else | 546 | else |
555 | { | 547 | { |
556 | oldest->rd = NULL; | 548 | oldest->rd = NULL; |
557 | } | 549 | } |
558 | oldest->last_used = GNUNET_TIME_absolute_get (); | 550 | oldest->last_used = GNUNET_TIME_absolute_get(); |
559 | } | 551 | } |
560 | 552 | ||
561 | 553 | ||
@@ -566,7 +558,7 @@ cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | |||
566 | * @return NULL if no NICK record was found | 558 | * @return NULL if no NICK record was found |
567 | */ | 559 | */ |
568 | static struct GNUNET_GNSRECORD_Data * | 560 | static struct GNUNET_GNSRECORD_Data * |
569 | get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) | 561 | get_nick_record(const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) |
570 | { | 562 | { |
571 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 563 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; |
572 | struct GNUNET_GNSRECORD_Data *nick; | 564 | struct GNUNET_GNSRECORD_Data *nick; |
@@ -574,53 +566,53 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) | |||
574 | 566 | ||
575 | /* check cache first */ | 567 | /* check cache first */ |
576 | for (unsigned int i = 0; i < NC_SIZE; i++) | 568 | for (unsigned int i = 0; i < NC_SIZE; i++) |
577 | { | ||
578 | struct NickCache *pos = &nick_cache[i]; | ||
579 | if ((NULL != pos->rd) && (0 == GNUNET_memcmp (zone, &pos->zone))) | ||
580 | { | 569 | { |
581 | if (NULL == pos->rd) | 570 | struct NickCache *pos = &nick_cache[i]; |
582 | return NULL; | 571 | if ((NULL != pos->rd) && (0 == GNUNET_memcmp(zone, &pos->zone))) |
583 | nick = GNUNET_malloc (sizeof (*nick) + pos->rd->data_size); | 572 | { |
584 | *nick = *pos->rd; | 573 | if (NULL == pos->rd) |
585 | nick->data = &nick[1]; | 574 | return NULL; |
586 | memcpy (&nick[1], pos->rd->data, pos->rd->data_size); | 575 | nick = GNUNET_malloc(sizeof(*nick) + pos->rd->data_size); |
587 | pos->last_used = GNUNET_TIME_absolute_get (); | 576 | *nick = *pos->rd; |
588 | return nick; | 577 | nick->data = &nick[1]; |
578 | memcpy(&nick[1], pos->rd->data, pos->rd->data_size); | ||
579 | pos->last_used = GNUNET_TIME_absolute_get(); | ||
580 | return nick; | ||
581 | } | ||
589 | } | 582 | } |
590 | } | ||
591 | 583 | ||
592 | nick = NULL; | 584 | nick = NULL; |
593 | res = GSN_database->lookup_records (GSN_database->cls, | 585 | res = GSN_database->lookup_records(GSN_database->cls, |
594 | zone, | 586 | zone, |
595 | GNUNET_GNS_EMPTY_LABEL_AT, | 587 | GNUNET_GNS_EMPTY_LABEL_AT, |
596 | &lookup_nick_it, | 588 | &lookup_nick_it, |
597 | &nick); | 589 | &nick); |
598 | if ((GNUNET_OK != res) || (NULL == nick)) | 590 | if ((GNUNET_OK != res) || (NULL == nick)) |
599 | { | ||
600 | #if ! defined(GNUNET_CULL_LOGGING) | ||
601 | static int do_log = GNUNET_LOG_CALL_STATUS; | ||
602 | |||
603 | if (0 == do_log) | ||
604 | do_log = GNUNET_get_log_call_status (GNUNET_ERROR_TYPE_DEBUG, | ||
605 | "namestore", | ||
606 | __FILE__, | ||
607 | __FUNCTION__, | ||
608 | __LINE__); | ||
609 | if (1 == do_log) | ||
610 | { | 591 | { |
611 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); | 592 | #if !defined(GNUNET_CULL_LOGGING) |
612 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 593 | static int do_log = GNUNET_LOG_CALL_STATUS; |
613 | "No nick name set for zone `%s'\n", | 594 | |
614 | GNUNET_GNSRECORD_z2s (&pub)); | 595 | if (0 == do_log) |
615 | } | 596 | do_log = GNUNET_get_log_call_status(GNUNET_ERROR_TYPE_DEBUG, |
597 | "namestore", | ||
598 | __FILE__, | ||
599 | __FUNCTION__, | ||
600 | __LINE__); | ||
601 | if (1 == do_log) | ||
602 | { | ||
603 | GNUNET_CRYPTO_ecdsa_key_get_public(zone, &pub); | ||
604 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
605 | "No nick name set for zone `%s'\n", | ||
606 | GNUNET_GNSRECORD_z2s(&pub)); | ||
607 | } | ||
616 | #endif | 608 | #endif |
617 | /* update cache */ | 609 | /* update cache */ |
618 | cache_nick (zone, NULL); | 610 | cache_nick(zone, NULL); |
619 | return NULL; | 611 | return NULL; |
620 | } | 612 | } |
621 | 613 | ||
622 | /* update cache */ | 614 | /* update cache */ |
623 | cache_nick (zone, nick); | 615 | cache_nick(zone, nick); |
624 | return nick; | 616 | return nick; |
625 | } | 617 | } |
626 | 618 | ||
@@ -641,11 +633,11 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) | |||
641 | * allocated in the same chunk of memory! | 633 | * allocated in the same chunk of memory! |
642 | */ | 634 | */ |
643 | static void | 635 | static void |
644 | merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd, | 636 | merge_with_nick_records(const struct GNUNET_GNSRECORD_Data *nick_rd, |
645 | unsigned int rd2_length, | 637 | unsigned int rd2_length, |
646 | const struct GNUNET_GNSRECORD_Data *rd2, | 638 | const struct GNUNET_GNSRECORD_Data *rd2, |
647 | unsigned int *rdc_res, | 639 | unsigned int *rdc_res, |
648 | struct GNUNET_GNSRECORD_Data **rd_res) | 640 | struct GNUNET_GNSRECORD_Data **rd_res) |
649 | { | 641 | { |
650 | uint64_t latest_expiration; | 642 | uint64_t latest_expiration; |
651 | size_t req; | 643 | size_t req; |
@@ -655,54 +647,54 @@ merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd, | |||
655 | 647 | ||
656 | (*rdc_res) = 1 + rd2_length; | 648 | (*rdc_res) = 1 + rd2_length; |
657 | if (0 == 1 + rd2_length) | 649 | if (0 == 1 + rd2_length) |
658 | { | ||
659 | GNUNET_break (0); | ||
660 | (*rd_res) = NULL; | ||
661 | return; | ||
662 | } | ||
663 | req = sizeof (struct GNUNET_GNSRECORD_Data) + nick_rd->data_size; | ||
664 | for (unsigned int i = 0; i < rd2_length; i++) | ||
665 | { | ||
666 | const struct GNUNET_GNSRECORD_Data *orig = &rd2[i]; | ||
667 | |||
668 | if (req + sizeof (struct GNUNET_GNSRECORD_Data) + orig->data_size < req) | ||
669 | { | 650 | { |
670 | GNUNET_break (0); | 651 | GNUNET_break(0); |
671 | (*rd_res) = NULL; | 652 | (*rd_res) = NULL; |
672 | return; | 653 | return; |
673 | } | 654 | } |
674 | req += sizeof (struct GNUNET_GNSRECORD_Data) + orig->data_size; | 655 | req = sizeof(struct GNUNET_GNSRECORD_Data) + nick_rd->data_size; |
675 | } | 656 | for (unsigned int i = 0; i < rd2_length; i++) |
676 | target = GNUNET_malloc (req); | 657 | { |
658 | const struct GNUNET_GNSRECORD_Data *orig = &rd2[i]; | ||
659 | |||
660 | if (req + sizeof(struct GNUNET_GNSRECORD_Data) + orig->data_size < req) | ||
661 | { | ||
662 | GNUNET_break(0); | ||
663 | (*rd_res) = NULL; | ||
664 | return; | ||
665 | } | ||
666 | req += sizeof(struct GNUNET_GNSRECORD_Data) + orig->data_size; | ||
667 | } | ||
668 | target = GNUNET_malloc(req); | ||
677 | (*rd_res) = target; | 669 | (*rd_res) = target; |
678 | data = (char *) &target[1 + rd2_length]; | 670 | data = (char *)&target[1 + rd2_length]; |
679 | data_offset = 0; | 671 | data_offset = 0; |
680 | latest_expiration = 0; | 672 | latest_expiration = 0; |
681 | for (unsigned int i = 0; i < rd2_length; i++) | 673 | for (unsigned int i = 0; i < rd2_length; i++) |
682 | { | ||
683 | const struct GNUNET_GNSRECORD_Data *orig = &rd2[i]; | ||
684 | |||
685 | if (0 != (orig->flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | ||
686 | { | 674 | { |
687 | if ((GNUNET_TIME_absolute_get ().abs_value_us + orig->expiration_time) > | 675 | const struct GNUNET_GNSRECORD_Data *orig = &rd2[i]; |
688 | latest_expiration) | 676 | |
677 | if (0 != (orig->flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | ||
678 | { | ||
679 | if ((GNUNET_TIME_absolute_get().abs_value_us + orig->expiration_time) > | ||
680 | latest_expiration) | ||
681 | latest_expiration = orig->expiration_time; | ||
682 | } | ||
683 | else if (orig->expiration_time > latest_expiration) | ||
689 | latest_expiration = orig->expiration_time; | 684 | latest_expiration = orig->expiration_time; |
685 | target[i] = *orig; | ||
686 | target[i].data = (void *)&data[data_offset]; | ||
687 | GNUNET_memcpy(&data[data_offset], orig->data, orig->data_size); | ||
688 | data_offset += orig->data_size; | ||
690 | } | 689 | } |
691 | else if (orig->expiration_time > latest_expiration) | ||
692 | latest_expiration = orig->expiration_time; | ||
693 | target[i] = *orig; | ||
694 | target[i].data = (void *) &data[data_offset]; | ||
695 | GNUNET_memcpy (&data[data_offset], orig->data, orig->data_size); | ||
696 | data_offset += orig->data_size; | ||
697 | } | ||
698 | /* append nick */ | 690 | /* append nick */ |
699 | target[rd2_length] = *nick_rd; | 691 | target[rd2_length] = *nick_rd; |
700 | target[rd2_length].expiration_time = latest_expiration; | 692 | target[rd2_length].expiration_time = latest_expiration; |
701 | target[rd2_length].data = (void *) &data[data_offset]; | 693 | target[rd2_length].data = (void *)&data[data_offset]; |
702 | GNUNET_memcpy (&data[data_offset], nick_rd->data, nick_rd->data_size); | 694 | GNUNET_memcpy(&data[data_offset], nick_rd->data, nick_rd->data_size); |
703 | data_offset += nick_rd->data_size; | 695 | data_offset += nick_rd->data_size; |
704 | GNUNET_assert (req == (sizeof (struct GNUNET_GNSRECORD_Data)) * (*rdc_res) + | 696 | GNUNET_assert(req == (sizeof(struct GNUNET_GNSRECORD_Data)) * (*rdc_res) + |
705 | data_offset); | 697 | data_offset); |
706 | } | 698 | } |
707 | 699 | ||
708 | 700 | ||
@@ -718,12 +710,12 @@ merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd, | |||
718 | * @param rd array of records | 710 | * @param rd array of records |
719 | */ | 711 | */ |
720 | static void | 712 | static void |
721 | send_lookup_response (struct NamestoreClient *nc, | 713 | send_lookup_response(struct NamestoreClient *nc, |
722 | uint32_t request_id, | 714 | uint32_t request_id, |
723 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 715 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
724 | const char *name, | 716 | const char *name, |
725 | unsigned int rd_count, | 717 | unsigned int rd_count, |
726 | const struct GNUNET_GNSRECORD_Data *rd) | 718 | const struct GNUNET_GNSRECORD_Data *rd) |
727 | { | 719 | { |
728 | struct GNUNET_MQ_Envelope *env; | 720 | struct GNUNET_MQ_Envelope *env; |
729 | struct RecordResultMessage *zir_msg; | 721 | struct RecordResultMessage *zir_msg; |
@@ -735,63 +727,63 @@ send_lookup_response (struct NamestoreClient *nc, | |||
735 | char *name_tmp; | 727 | char *name_tmp; |
736 | char *rd_ser; | 728 | char *rd_ser; |
737 | 729 | ||
738 | nick = get_nick_record (zone_key); | 730 | nick = get_nick_record(zone_key); |
739 | GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (rd_count, rd)); | 731 | GNUNET_assert(-1 != GNUNET_GNSRECORD_records_get_size(rd_count, rd)); |
740 | 732 | ||
741 | if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT))) | 733 | if ((NULL != nick) && (0 != strcmp(name, GNUNET_GNS_EMPTY_LABEL_AT))) |
742 | { | 734 | { |
743 | nick->flags = | 735 | nick->flags = |
744 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; | 736 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; |
745 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); | 737 | merge_with_nick_records(nick, rd_count, rd, &res_count, &res); |
746 | GNUNET_free (nick); | 738 | GNUNET_free(nick); |
747 | } | 739 | } |
748 | else | 740 | else |
749 | { | 741 | { |
750 | res_count = rd_count; | 742 | res_count = rd_count; |
751 | res = (struct GNUNET_GNSRECORD_Data *) rd; | 743 | res = (struct GNUNET_GNSRECORD_Data *)rd; |
752 | } | 744 | } |
753 | 745 | ||
754 | GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (res_count, res)); | 746 | GNUNET_assert(-1 != GNUNET_GNSRECORD_records_get_size(res_count, res)); |
755 | 747 | ||
756 | 748 | ||
757 | name_len = strlen (name) + 1; | 749 | name_len = strlen(name) + 1; |
758 | rd_ser_len = GNUNET_GNSRECORD_records_get_size (res_count, res); | 750 | rd_ser_len = GNUNET_GNSRECORD_records_get_size(res_count, res); |
759 | if (rd_ser_len < 0) | 751 | if (rd_ser_len < 0) |
760 | { | 752 | { |
761 | GNUNET_break (0); | 753 | GNUNET_break(0); |
762 | GNUNET_SERVICE_client_drop (nc->client); | 754 | GNUNET_SERVICE_client_drop(nc->client); |
763 | return; | 755 | return; |
764 | } | 756 | } |
765 | if (((size_t) rd_ser_len) >= UINT16_MAX - name_len - sizeof (*zir_msg)) | 757 | if (((size_t)rd_ser_len) >= UINT16_MAX - name_len - sizeof(*zir_msg)) |
766 | { | 758 | { |
767 | GNUNET_break (0); | 759 | GNUNET_break(0); |
768 | GNUNET_SERVICE_client_drop (nc->client); | 760 | GNUNET_SERVICE_client_drop(nc->client); |
769 | return; | 761 | return; |
770 | } | 762 | } |
771 | env = GNUNET_MQ_msg_extra (zir_msg, | 763 | env = GNUNET_MQ_msg_extra(zir_msg, |
772 | name_len + rd_ser_len, | 764 | name_len + rd_ser_len, |
773 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT); | 765 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT); |
774 | zir_msg->gns_header.r_id = htonl (request_id); | 766 | zir_msg->gns_header.r_id = htonl(request_id); |
775 | zir_msg->name_len = htons (name_len); | 767 | zir_msg->name_len = htons(name_len); |
776 | zir_msg->rd_count = htons (res_count); | 768 | zir_msg->rd_count = htons(res_count); |
777 | zir_msg->rd_len = htons ((uint16_t) rd_ser_len); | 769 | zir_msg->rd_len = htons((uint16_t)rd_ser_len); |
778 | zir_msg->private_key = *zone_key; | 770 | zir_msg->private_key = *zone_key; |
779 | name_tmp = (char *) &zir_msg[1]; | 771 | name_tmp = (char *)&zir_msg[1]; |
780 | GNUNET_memcpy (name_tmp, name, name_len); | 772 | GNUNET_memcpy(name_tmp, name, name_len); |
781 | rd_ser = &name_tmp[name_len]; | 773 | rd_ser = &name_tmp[name_len]; |
782 | GNUNET_assert ( | 774 | GNUNET_assert( |
783 | rd_ser_len == | 775 | rd_ser_len == |
784 | GNUNET_GNSRECORD_records_serialize (res_count, res, rd_ser_len, rd_ser)); | 776 | GNUNET_GNSRECORD_records_serialize(res_count, res, rd_ser_len, rd_ser)); |
785 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 777 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
786 | "Sending RECORD_RESULT message with %u records\n", | 778 | "Sending RECORD_RESULT message with %u records\n", |
787 | res_count); | 779 | res_count); |
788 | GNUNET_STATISTICS_update (statistics, | 780 | GNUNET_STATISTICS_update(statistics, |
789 | "Record sets sent to clients", | 781 | "Record sets sent to clients", |
790 | 1, | 782 | 1, |
791 | GNUNET_NO); | 783 | GNUNET_NO); |
792 | GNUNET_MQ_send (nc->mq, env); | 784 | GNUNET_MQ_send(nc->mq, env); |
793 | if (rd != res) | 785 | if (rd != res) |
794 | GNUNET_free (res); | 786 | GNUNET_free(res); |
795 | } | 787 | } |
796 | 788 | ||
797 | 789 | ||
@@ -803,23 +795,23 @@ send_lookup_response (struct NamestoreClient *nc, | |||
803 | * @param rid client's request ID | 795 | * @param rid client's request ID |
804 | */ | 796 | */ |
805 | static void | 797 | static void |
806 | send_store_response (struct NamestoreClient *nc, int res, uint32_t rid) | 798 | send_store_response(struct NamestoreClient *nc, int res, uint32_t rid) |
807 | { | 799 | { |
808 | struct GNUNET_MQ_Envelope *env; | 800 | struct GNUNET_MQ_Envelope *env; |
809 | struct RecordStoreResponseMessage *rcr_msg; | 801 | struct RecordStoreResponseMessage *rcr_msg; |
810 | 802 | ||
811 | GNUNET_assert (NULL != nc); | 803 | GNUNET_assert(NULL != nc); |
812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 804 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
813 | "Sending RECORD_STORE_RESPONSE message\n"); | 805 | "Sending RECORD_STORE_RESPONSE message\n"); |
814 | GNUNET_STATISTICS_update (statistics, | 806 | GNUNET_STATISTICS_update(statistics, |
815 | "Store requests completed", | 807 | "Store requests completed", |
816 | 1, | 808 | 1, |
817 | GNUNET_NO); | 809 | GNUNET_NO); |
818 | env = GNUNET_MQ_msg (rcr_msg, | 810 | env = GNUNET_MQ_msg(rcr_msg, |
819 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE); | 811 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE); |
820 | rcr_msg->gns_header.r_id = htonl (rid); | 812 | rcr_msg->gns_header.r_id = htonl(rid); |
821 | rcr_msg->op_result = htonl (res); | 813 | rcr_msg->op_result = htonl(res); |
822 | GNUNET_MQ_send (nc->mq, env); | 814 | GNUNET_MQ_send(nc->mq, env); |
823 | } | 815 | } |
824 | 816 | ||
825 | 817 | ||
@@ -830,21 +822,21 @@ send_store_response (struct NamestoreClient *nc, int res, uint32_t rid) | |||
830 | * @param zi zone iteration we are processing | 822 | * @param zi zone iteration we are processing |
831 | */ | 823 | */ |
832 | static void | 824 | static void |
833 | zone_iteration_done_client_continue (struct ZoneIteration *zi) | 825 | zone_iteration_done_client_continue(struct ZoneIteration *zi) |
834 | { | 826 | { |
835 | struct GNUNET_MQ_Envelope *env; | 827 | struct GNUNET_MQ_Envelope *env; |
836 | struct GNUNET_NAMESTORE_Header *em; | 828 | struct GNUNET_NAMESTORE_Header *em; |
837 | 829 | ||
838 | GNUNET_SERVICE_client_continue (zi->nc->client); | 830 | GNUNET_SERVICE_client_continue(zi->nc->client); |
839 | if (! zi->send_end) | 831 | if (!zi->send_end) |
840 | return; | 832 | return; |
841 | /* send empty response to indicate end of list */ | 833 | /* send empty response to indicate end of list */ |
842 | env = GNUNET_MQ_msg (em, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END); | 834 | env = GNUNET_MQ_msg(em, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END); |
843 | em->r_id = htonl (zi->request_id); | 835 | em->r_id = htonl(zi->request_id); |
844 | GNUNET_MQ_send (zi->nc->mq, env); | 836 | GNUNET_MQ_send(zi->nc->mq, env); |
845 | 837 | ||
846 | GNUNET_CONTAINER_DLL_remove (zi->nc->op_head, zi->nc->op_tail, zi); | 838 | GNUNET_CONTAINER_DLL_remove(zi->nc->op_head, zi->nc->op_tail, zi); |
847 | GNUNET_free (zi); | 839 | GNUNET_free(zi); |
848 | } | 840 | } |
849 | 841 | ||
850 | 842 | ||
@@ -856,30 +848,30 @@ zone_iteration_done_client_continue (struct ZoneIteration *zi) | |||
856 | * @param emsg error messages | 848 | * @param emsg error messages |
857 | */ | 849 | */ |
858 | static void | 850 | static void |
859 | finish_cache_operation (void *cls, int32_t success, const char *emsg) | 851 | finish_cache_operation(void *cls, int32_t success, const char *emsg) |
860 | { | 852 | { |
861 | struct CacheOperation *cop = cls; | 853 | struct CacheOperation *cop = cls; |
862 | struct ZoneIteration *zi; | 854 | struct ZoneIteration *zi; |
863 | 855 | ||
864 | if (NULL != emsg) | 856 | if (NULL != emsg) |
865 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 857 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
866 | _ ("Failed to replicate block in namecache: %s\n"), | 858 | _("Failed to replicate block in namecache: %s\n"), |
867 | emsg); | 859 | emsg); |
868 | else | 860 | else |
869 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CACHE operation completed\n"); | 861 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "CACHE operation completed\n"); |
870 | GNUNET_CONTAINER_DLL_remove (cop_head, cop_tail, cop); | 862 | GNUNET_CONTAINER_DLL_remove(cop_head, cop_tail, cop); |
871 | if (NULL != cop->nc) | 863 | if (NULL != cop->nc) |
872 | send_store_response (cop->nc, success, cop->rid); | 864 | send_store_response(cop->nc, success, cop->rid); |
873 | if (NULL != (zi = cop->zi)) | 865 | if (NULL != (zi = cop->zi)) |
874 | { | ||
875 | zi->cache_ops--; | ||
876 | if (0 == zi->cache_ops) | ||
877 | { | 866 | { |
878 | /* unchoke zone iteration, cache has caught up */ | 867 | zi->cache_ops--; |
879 | zone_iteration_done_client_continue (zi); | 868 | if (0 == zi->cache_ops) |
869 | { | ||
870 | /* unchoke zone iteration, cache has caught up */ | ||
871 | zone_iteration_done_client_continue(zi); | ||
872 | } | ||
880 | } | 873 | } |
881 | } | 874 | GNUNET_free(cop); |
882 | GNUNET_free (cop); | ||
883 | } | 875 | } |
884 | 876 | ||
885 | 877 | ||
@@ -896,13 +888,13 @@ finish_cache_operation (void *cls, int32_t success, const char *emsg) | |||
896 | * @param rd records stored under the given @a name | 888 | * @param rd records stored under the given @a name |
897 | */ | 889 | */ |
898 | static void | 890 | static void |
899 | refresh_block (struct NamestoreClient *nc, | 891 | refresh_block(struct NamestoreClient *nc, |
900 | struct ZoneIteration *zi, | 892 | struct ZoneIteration *zi, |
901 | uint32_t rid, | 893 | uint32_t rid, |
902 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 894 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
903 | const char *name, | 895 | const char *name, |
904 | unsigned int rd_count, | 896 | unsigned int rd_count, |
905 | const struct GNUNET_GNSRECORD_Data *rd) | 897 | const struct GNUNET_GNSRECORD_Data *rd) |
906 | { | 898 | { |
907 | struct GNUNET_GNSRECORD_Block *block; | 899 | struct GNUNET_GNSRECORD_Block *block; |
908 | struct CacheOperation *cop; | 900 | struct CacheOperation *cop; |
@@ -912,64 +904,64 @@ refresh_block (struct NamestoreClient *nc, | |||
912 | unsigned int res_count; | 904 | unsigned int res_count; |
913 | struct GNUNET_TIME_Absolute exp_time; | 905 | struct GNUNET_TIME_Absolute exp_time; |
914 | 906 | ||
915 | nick = get_nick_record (zone_key); | 907 | nick = get_nick_record(zone_key); |
916 | res_count = rd_count; | 908 | res_count = rd_count; |
917 | res = (struct GNUNET_GNSRECORD_Data *) rd; /* fixme: a bit unclean... */ | 909 | res = (struct GNUNET_GNSRECORD_Data *)rd; /* fixme: a bit unclean... */ |
918 | if (NULL != nick) | 910 | if (NULL != nick) |
919 | { | 911 | { |
920 | nick->flags = | 912 | nick->flags = |
921 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; | 913 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; |
922 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); | 914 | merge_with_nick_records(nick, rd_count, rd, &res_count, &res); |
923 | GNUNET_free (nick); | 915 | GNUNET_free(nick); |
924 | } | 916 | } |
925 | if (0 == res_count) | 917 | if (0 == res_count) |
926 | { | 918 | { |
927 | if (NULL != nc) | 919 | if (NULL != nc) |
928 | send_store_response (nc, GNUNET_OK, rid); | 920 | send_store_response(nc, GNUNET_OK, rid); |
929 | return; /* no data, no need to update cache */ | 921 | return; /* no data, no need to update cache */ |
930 | } | 922 | } |
931 | if (GNUNET_YES == disable_namecache) | 923 | if (GNUNET_YES == disable_namecache) |
932 | { | 924 | { |
933 | GNUNET_STATISTICS_update (statistics, | 925 | GNUNET_STATISTICS_update(statistics, |
934 | "Namecache updates skipped (NC disabled)", | 926 | "Namecache updates skipped (NC disabled)", |
935 | 1, | 927 | 1, |
936 | GNUNET_NO); | 928 | GNUNET_NO); |
937 | if (NULL != nc) | 929 | if (NULL != nc) |
938 | send_store_response (nc, GNUNET_OK, rid); | 930 | send_store_response(nc, GNUNET_OK, rid); |
939 | return; | 931 | return; |
940 | } | 932 | } |
941 | exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, res); | 933 | exp_time = GNUNET_GNSRECORD_record_get_expiration_time(res_count, res); |
942 | if (cache_keys) | 934 | if (cache_keys) |
943 | block = | 935 | block = |
944 | GNUNET_GNSRECORD_block_create2 (zone_key, exp_time, name, res, res_count); | 936 | GNUNET_GNSRECORD_block_create2(zone_key, exp_time, name, res, res_count); |
945 | else | 937 | else |
946 | block = | 938 | block = |
947 | GNUNET_GNSRECORD_block_create (zone_key, exp_time, name, res, res_count); | 939 | GNUNET_GNSRECORD_block_create(zone_key, exp_time, name, res, res_count); |
948 | GNUNET_assert (NULL != block); | 940 | GNUNET_assert(NULL != block); |
949 | GNUNET_CRYPTO_ecdsa_key_get_public (zone_key, &pkey); | 941 | GNUNET_CRYPTO_ecdsa_key_get_public(zone_key, &pkey); |
950 | GNUNET_log ( | 942 | GNUNET_log( |
951 | GNUNET_ERROR_TYPE_DEBUG, | 943 | GNUNET_ERROR_TYPE_DEBUG, |
952 | "Caching block for label `%s' with %u records and expiration %s in zone `%s' in namecache\n", | 944 | "Caching block for label `%s' with %u records and expiration %s in zone `%s' in namecache\n", |
953 | name, | 945 | name, |
954 | res_count, | 946 | res_count, |
955 | GNUNET_STRINGS_absolute_time_to_string (exp_time), | 947 | GNUNET_STRINGS_absolute_time_to_string(exp_time), |
956 | GNUNET_GNSRECORD_z2s (&pkey)); | 948 | GNUNET_GNSRECORD_z2s(&pkey)); |
957 | GNUNET_STATISTICS_update (statistics, | 949 | GNUNET_STATISTICS_update(statistics, |
958 | "Namecache updates pushed", | 950 | "Namecache updates pushed", |
959 | 1, | 951 | 1, |
960 | GNUNET_NO); | 952 | GNUNET_NO); |
961 | cop = GNUNET_new (struct CacheOperation); | 953 | cop = GNUNET_new(struct CacheOperation); |
962 | cop->nc = nc; | 954 | cop->nc = nc; |
963 | cop->zi = zi; | 955 | cop->zi = zi; |
964 | if (NULL != zi) | 956 | if (NULL != zi) |
965 | zi->cache_ops++; | 957 | zi->cache_ops++; |
966 | cop->rid = rid; | 958 | cop->rid = rid; |
967 | GNUNET_CONTAINER_DLL_insert (cop_head, cop_tail, cop); | 959 | GNUNET_CONTAINER_DLL_insert(cop_head, cop_tail, cop); |
968 | cop->qe = GNUNET_NAMECACHE_block_cache (namecache, | 960 | cop->qe = GNUNET_NAMECACHE_block_cache(namecache, |
969 | block, | 961 | block, |
970 | &finish_cache_operation, | 962 | &finish_cache_operation, |
971 | cop); | 963 | cop); |
972 | GNUNET_free (block); | 964 | GNUNET_free(block); |
973 | } | 965 | } |
974 | 966 | ||
975 | 967 | ||
@@ -979,16 +971,16 @@ refresh_block (struct NamestoreClient *nc, | |||
979 | * @param cls a `struct ZoneMonitor` to warn about | 971 | * @param cls a `struct ZoneMonitor` to warn about |
980 | */ | 972 | */ |
981 | static void | 973 | static void |
982 | warn_monitor_slow (void *cls) | 974 | warn_monitor_slow(void *cls) |
983 | { | 975 | { |
984 | struct ZoneMonitor *zm = cls; | 976 | struct ZoneMonitor *zm = cls; |
985 | 977 | ||
986 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 978 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
987 | "No response from monitor since %s\n", | 979 | "No response from monitor since %s\n", |
988 | GNUNET_STRINGS_absolute_time_to_string (zm->sa_waiting_start)); | 980 | GNUNET_STRINGS_absolute_time_to_string(zm->sa_waiting_start)); |
989 | zm->sa_wait_warning = GNUNET_SCHEDULER_add_delayed (MONITOR_STALL_WARN_DELAY, | 981 | zm->sa_wait_warning = GNUNET_SCHEDULER_add_delayed(MONITOR_STALL_WARN_DELAY, |
990 | &warn_monitor_slow, | 982 | &warn_monitor_slow, |
991 | zm); | 983 | zm); |
992 | } | 984 | } |
993 | 985 | ||
994 | 986 | ||
@@ -998,7 +990,7 @@ warn_monitor_slow (void *cls) | |||
998 | * @param sa store activity to process | 990 | * @param sa store activity to process |
999 | */ | 991 | */ |
1000 | static void | 992 | static void |
1001 | continue_store_activity (struct StoreActivity *sa) | 993 | continue_store_activity(struct StoreActivity *sa) |
1002 | { | 994 | { |
1003 | const struct RecordStoreMessage *rp_msg = sa->rsm; | 995 | const struct RecordStoreMessage *rp_msg = sa->rsm; |
1004 | unsigned int rd_count; | 996 | unsigned int rd_count; |
@@ -1008,63 +1000,63 @@ continue_store_activity (struct StoreActivity *sa) | |||
1008 | const char *name_tmp; | 1000 | const char *name_tmp; |
1009 | const char *rd_ser; | 1001 | const char *rd_ser; |
1010 | 1002 | ||
1011 | rid = ntohl (rp_msg->gns_header.r_id); | 1003 | rid = ntohl(rp_msg->gns_header.r_id); |
1012 | name_len = ntohs (rp_msg->name_len); | 1004 | name_len = ntohs(rp_msg->name_len); |
1013 | rd_count = ntohs (rp_msg->rd_count); | 1005 | rd_count = ntohs(rp_msg->rd_count); |
1014 | rd_ser_len = ntohs (rp_msg->rd_len); | 1006 | rd_ser_len = ntohs(rp_msg->rd_len); |
1015 | name_tmp = (const char *) &rp_msg[1]; | 1007 | name_tmp = (const char *)&rp_msg[1]; |
1016 | rd_ser = &name_tmp[name_len]; | 1008 | rd_ser = &name_tmp[name_len]; |
1017 | { | 1009 | { |
1018 | struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL (rd_count)]; | 1010 | struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL(rd_count)]; |
1019 | 1011 | ||
1020 | /* We did this before, must succeed again */ | 1012 | /* We did this before, must succeed again */ |
1021 | GNUNET_assert ( | 1013 | GNUNET_assert( |
1022 | GNUNET_OK == | 1014 | GNUNET_OK == |
1023 | GNUNET_GNSRECORD_records_deserialize (rd_ser_len, rd_ser, rd_count, rd)); | 1015 | GNUNET_GNSRECORD_records_deserialize(rd_ser_len, rd_ser, rd_count, rd)); |
1024 | 1016 | ||
1025 | for (struct ZoneMonitor *zm = sa->zm_pos; NULL != zm; zm = sa->zm_pos) | 1017 | for (struct ZoneMonitor *zm = sa->zm_pos; NULL != zm; zm = sa->zm_pos) |
1026 | { | ||
1027 | if ((0 != GNUNET_memcmp (&rp_msg->private_key, &zm->zone)) && | ||
1028 | (0 != GNUNET_memcmp (&zm->zone, &zero))) | ||
1029 | { | ||
1030 | sa->zm_pos = zm->next; /* not interesting to this monitor */ | ||
1031 | continue; | ||
1032 | } | ||
1033 | if (zm->limit == zm->iteration_cnt) | ||
1034 | { | 1018 | { |
1035 | zm->sa_waiting = GNUNET_YES; | 1019 | if ((0 != GNUNET_memcmp(&rp_msg->private_key, &zm->zone)) && |
1036 | zm->sa_waiting_start = GNUNET_TIME_absolute_get (); | 1020 | (0 != GNUNET_memcmp(&zm->zone, &zero))) |
1037 | if (NULL != zm->sa_wait_warning) | 1021 | { |
1038 | GNUNET_SCHEDULER_cancel (zm->sa_wait_warning); | 1022 | sa->zm_pos = zm->next; /* not interesting to this monitor */ |
1039 | zm->sa_wait_warning = | 1023 | continue; |
1040 | GNUNET_SCHEDULER_add_delayed (MONITOR_STALL_WARN_DELAY, | 1024 | } |
1041 | &warn_monitor_slow, | 1025 | if (zm->limit == zm->iteration_cnt) |
1042 | zm); | 1026 | { |
1043 | return; /* blocked on zone monitor */ | 1027 | zm->sa_waiting = GNUNET_YES; |
1028 | zm->sa_waiting_start = GNUNET_TIME_absolute_get(); | ||
1029 | if (NULL != zm->sa_wait_warning) | ||
1030 | GNUNET_SCHEDULER_cancel(zm->sa_wait_warning); | ||
1031 | zm->sa_wait_warning = | ||
1032 | GNUNET_SCHEDULER_add_delayed(MONITOR_STALL_WARN_DELAY, | ||
1033 | &warn_monitor_slow, | ||
1034 | zm); | ||
1035 | return; /* blocked on zone monitor */ | ||
1036 | } | ||
1037 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1038 | "Notifying monitor about changes under label `%s'\n", | ||
1039 | sa->conv_name); | ||
1040 | zm->limit--; | ||
1041 | send_lookup_response(zm->nc, | ||
1042 | 0, | ||
1043 | &rp_msg->private_key, | ||
1044 | sa->conv_name, | ||
1045 | rd_count, | ||
1046 | rd); | ||
1047 | sa->zm_pos = zm->next; | ||
1044 | } | 1048 | } |
1045 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1046 | "Notifying monitor about changes under label `%s'\n", | ||
1047 | sa->conv_name); | ||
1048 | zm->limit--; | ||
1049 | send_lookup_response (zm->nc, | ||
1050 | 0, | ||
1051 | &rp_msg->private_key, | ||
1052 | sa->conv_name, | ||
1053 | rd_count, | ||
1054 | rd); | ||
1055 | sa->zm_pos = zm->next; | ||
1056 | } | ||
1057 | /* great, done with the monitors, unpack (again) for refresh_block operation */ | 1049 | /* great, done with the monitors, unpack (again) for refresh_block operation */ |
1058 | refresh_block (sa->nc, | 1050 | refresh_block(sa->nc, |
1059 | NULL, | 1051 | NULL, |
1060 | rid, | 1052 | rid, |
1061 | &rp_msg->private_key, | 1053 | &rp_msg->private_key, |
1062 | sa->conv_name, | 1054 | sa->conv_name, |
1063 | rd_count, | 1055 | rd_count, |
1064 | rd); | 1056 | rd); |
1065 | } | 1057 | } |
1066 | GNUNET_SERVICE_client_continue (sa->nc->client); | 1058 | GNUNET_SERVICE_client_continue(sa->nc->client); |
1067 | free_store_activity (sa); | 1059 | free_store_activity(sa); |
1068 | } | 1060 | } |
1069 | 1061 | ||
1070 | 1062 | ||
@@ -1077,64 +1069,64 @@ continue_store_activity (struct StoreActivity *sa) | |||
1077 | * @param app_ctx the `struct NamestoreClient` of @a client | 1069 | * @param app_ctx the `struct NamestoreClient` of @a client |
1078 | */ | 1070 | */ |
1079 | static void | 1071 | static void |
1080 | client_disconnect_cb (void *cls, | 1072 | client_disconnect_cb(void *cls, |
1081 | struct GNUNET_SERVICE_Client *client, | 1073 | struct GNUNET_SERVICE_Client *client, |
1082 | void *app_ctx) | 1074 | void *app_ctx) |
1083 | { | 1075 | { |
1084 | struct NamestoreClient *nc = app_ctx; | 1076 | struct NamestoreClient *nc = app_ctx; |
1085 | struct ZoneIteration *no; | 1077 | struct ZoneIteration *no; |
1086 | struct CacheOperation *cop; | 1078 | struct CacheOperation *cop; |
1087 | 1079 | ||
1088 | (void) cls; | 1080 | (void)cls; |
1089 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); | 1081 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); |
1090 | for (struct ZoneMonitor *zm = monitor_head; NULL != zm; zm = zm->next) | 1082 | for (struct ZoneMonitor *zm = monitor_head; NULL != zm; zm = zm->next) |
1091 | { | ||
1092 | struct StoreActivity *san; | ||
1093 | |||
1094 | if (nc != zm->nc) | ||
1095 | continue; | ||
1096 | GNUNET_CONTAINER_DLL_remove (monitor_head, monitor_tail, zm); | ||
1097 | if (NULL != zm->task) | ||
1098 | { | 1083 | { |
1099 | GNUNET_SCHEDULER_cancel (zm->task); | 1084 | struct StoreActivity *san; |
1100 | zm->task = NULL; | 1085 | |
1101 | } | 1086 | if (nc != zm->nc) |
1102 | if (NULL != zm->sa_wait_warning) | 1087 | continue; |
1103 | { | 1088 | GNUNET_CONTAINER_DLL_remove(monitor_head, monitor_tail, zm); |
1104 | GNUNET_SCHEDULER_cancel (zm->sa_wait_warning); | 1089 | if (NULL != zm->task) |
1105 | zm->sa_wait_warning = NULL; | 1090 | { |
1106 | } | 1091 | GNUNET_SCHEDULER_cancel(zm->task); |
1107 | for (struct StoreActivity *sa = sa_head; NULL != sa; sa = san) | 1092 | zm->task = NULL; |
1108 | { | 1093 | } |
1109 | san = sa->next; | 1094 | if (NULL != zm->sa_wait_warning) |
1110 | if (zm == sa->zm_pos) | 1095 | { |
1111 | { | 1096 | GNUNET_SCHEDULER_cancel(zm->sa_wait_warning); |
1112 | sa->zm_pos = zm->next; | 1097 | zm->sa_wait_warning = NULL; |
1113 | /* this may free sa */ | 1098 | } |
1114 | continue_store_activity (sa); | 1099 | for (struct StoreActivity *sa = sa_head; NULL != sa; sa = san) |
1115 | } | 1100 | { |
1101 | san = sa->next; | ||
1102 | if (zm == sa->zm_pos) | ||
1103 | { | ||
1104 | sa->zm_pos = zm->next; | ||
1105 | /* this may free sa */ | ||
1106 | continue_store_activity(sa); | ||
1107 | } | ||
1108 | } | ||
1109 | GNUNET_free(zm); | ||
1110 | break; | ||
1116 | } | 1111 | } |
1117 | GNUNET_free (zm); | ||
1118 | break; | ||
1119 | } | ||
1120 | for (struct StoreActivity *sa = sa_head; NULL != sa; sa = sa->next) | 1112 | for (struct StoreActivity *sa = sa_head; NULL != sa; sa = sa->next) |
1121 | { | ||
1122 | if (sa->nc == nc) | ||
1123 | { | 1113 | { |
1124 | /* this may free sa */ | 1114 | if (sa->nc == nc) |
1125 | free_store_activity (sa); | 1115 | { |
1126 | break; /* there can only be one per nc */ | 1116 | /* this may free sa */ |
1117 | free_store_activity(sa); | ||
1118 | break; /* there can only be one per nc */ | ||
1119 | } | ||
1127 | } | 1120 | } |
1128 | } | ||
1129 | while (NULL != (no = nc->op_head)) | 1121 | while (NULL != (no = nc->op_head)) |
1130 | { | 1122 | { |
1131 | GNUNET_CONTAINER_DLL_remove (nc->op_head, nc->op_tail, no); | 1123 | GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, no); |
1132 | GNUNET_free (no); | 1124 | GNUNET_free(no); |
1133 | } | 1125 | } |
1134 | for (cop = cop_head; NULL != cop; cop = cop->next) | 1126 | for (cop = cop_head; NULL != cop; cop = cop->next) |
1135 | if (nc == cop->nc) | 1127 | if (nc == cop->nc) |
1136 | cop->nc = NULL; | 1128 | cop->nc = NULL; |
1137 | GNUNET_free (nc); | 1129 | GNUNET_free(nc); |
1138 | } | 1130 | } |
1139 | 1131 | ||
1140 | 1132 | ||
@@ -1147,15 +1139,15 @@ client_disconnect_cb (void *cls, | |||
1147 | * @return internal namestore client structure for this client | 1139 | * @return internal namestore client structure for this client |
1148 | */ | 1140 | */ |
1149 | static void * | 1141 | static void * |
1150 | client_connect_cb (void *cls, | 1142 | client_connect_cb(void *cls, |
1151 | struct GNUNET_SERVICE_Client *client, | 1143 | struct GNUNET_SERVICE_Client *client, |
1152 | struct GNUNET_MQ_Handle *mq) | 1144 | struct GNUNET_MQ_Handle *mq) |
1153 | { | 1145 | { |
1154 | struct NamestoreClient *nc; | 1146 | struct NamestoreClient *nc; |
1155 | 1147 | ||
1156 | (void) cls; | 1148 | (void)cls; |
1157 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); | 1149 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); |
1158 | nc = GNUNET_new (struct NamestoreClient); | 1150 | nc = GNUNET_new(struct NamestoreClient); |
1159 | nc->client = client; | 1151 | nc->client = client; |
1160 | nc->mq = mq; | 1152 | nc->mq = mq; |
1161 | return nc; | 1153 | return nc; |
@@ -1165,9 +1157,7 @@ client_connect_cb (void *cls, | |||
1165 | /** | 1157 | /** |
1166 | * Closure for #lookup_it(). | 1158 | * Closure for #lookup_it(). |
1167 | */ | 1159 | */ |
1168 | struct RecordLookupContext | 1160 | struct RecordLookupContext { |
1169 | { | ||
1170 | |||
1171 | /** | 1161 | /** |
1172 | * FIXME. | 1162 | * FIXME. |
1173 | */ | 1163 | */ |
@@ -1213,93 +1203,93 @@ struct RecordLookupContext | |||
1213 | * @param rd array of records with data to store | 1203 | * @param rd array of records with data to store |
1214 | */ | 1204 | */ |
1215 | static void | 1205 | static void |
1216 | lookup_it (void *cls, | 1206 | lookup_it(void *cls, |
1217 | uint64_t seq, | 1207 | uint64_t seq, |
1218 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 1208 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, |
1219 | const char *label, | 1209 | const char *label, |
1220 | unsigned int rd_count, | 1210 | unsigned int rd_count, |
1221 | const struct GNUNET_GNSRECORD_Data *rd) | 1211 | const struct GNUNET_GNSRECORD_Data *rd) |
1222 | { | 1212 | { |
1223 | struct RecordLookupContext *rlc = cls; | 1213 | struct RecordLookupContext *rlc = cls; |
1224 | 1214 | ||
1225 | (void) private_key; | 1215 | (void)private_key; |
1226 | GNUNET_assert (0 != seq); | 1216 | GNUNET_assert(0 != seq); |
1227 | if (0 != strcmp (label, rlc->label)) | 1217 | if (0 != strcmp(label, rlc->label)) |
1228 | return; | 1218 | return; |
1229 | rlc->found = GNUNET_YES; | 1219 | rlc->found = GNUNET_YES; |
1230 | if (0 == rd_count) | 1220 | if (0 == rd_count) |
1231 | { | ||
1232 | rlc->rd_ser_len = 0; | ||
1233 | rlc->res_rd_count = 0; | ||
1234 | rlc->res_rd = NULL; | ||
1235 | return; | ||
1236 | } | ||
1237 | if ((NULL != rlc->nick) && (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT))) | ||
1238 | { | ||
1239 | /* Merge */ | ||
1240 | struct GNUNET_GNSRECORD_Data *rd_res; | ||
1241 | unsigned int rdc_res; | ||
1242 | |||
1243 | rd_res = NULL; | ||
1244 | rdc_res = 0; | ||
1245 | rlc->nick->flags = (rlc->nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ | ||
1246 | GNUNET_GNSRECORD_RF_PRIVATE; | ||
1247 | merge_with_nick_records (rlc->nick, rd_count, rd, &rdc_res, &rd_res); | ||
1248 | rlc->rd_ser_len = GNUNET_GNSRECORD_records_get_size (rdc_res, rd_res); | ||
1249 | if (rlc->rd_ser_len < 0) | ||
1250 | { | 1221 | { |
1251 | GNUNET_break (0); | ||
1252 | GNUNET_free (rd_res); | ||
1253 | rlc->found = GNUNET_NO; | ||
1254 | rlc->rd_ser_len = 0; | 1222 | rlc->rd_ser_len = 0; |
1255 | return; | ||
1256 | } | ||
1257 | rlc->res_rd_count = rdc_res; | ||
1258 | rlc->res_rd = GNUNET_malloc (rlc->rd_ser_len); | ||
1259 | if (rlc->rd_ser_len != GNUNET_GNSRECORD_records_serialize (rdc_res, | ||
1260 | rd_res, | ||
1261 | rlc->rd_ser_len, | ||
1262 | rlc->res_rd)) | ||
1263 | { | ||
1264 | GNUNET_break (0); | ||
1265 | GNUNET_free (rlc->res_rd); | ||
1266 | rlc->res_rd = NULL; | ||
1267 | rlc->res_rd_count = 0; | 1223 | rlc->res_rd_count = 0; |
1268 | rlc->rd_ser_len = 0; | 1224 | rlc->res_rd = NULL; |
1269 | GNUNET_free (rd_res); | ||
1270 | rlc->found = GNUNET_NO; | ||
1271 | return; | 1225 | return; |
1272 | } | 1226 | } |
1273 | GNUNET_free (rd_res); | 1227 | if ((NULL != rlc->nick) && (0 != strcmp(label, GNUNET_GNS_EMPTY_LABEL_AT))) |
1274 | GNUNET_free (rlc->nick); | ||
1275 | rlc->nick = NULL; | ||
1276 | } | ||
1277 | else | ||
1278 | { | ||
1279 | rlc->rd_ser_len = GNUNET_GNSRECORD_records_get_size (rd_count, rd); | ||
1280 | if (rlc->rd_ser_len < 0) | ||
1281 | { | 1228 | { |
1282 | GNUNET_break (0); | 1229 | /* Merge */ |
1283 | rlc->found = GNUNET_NO; | 1230 | struct GNUNET_GNSRECORD_Data *rd_res; |
1284 | rlc->rd_ser_len = 0; | 1231 | unsigned int rdc_res; |
1285 | return; | 1232 | |
1233 | rd_res = NULL; | ||
1234 | rdc_res = 0; | ||
1235 | rlc->nick->flags = (rlc->nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ | ||
1236 | GNUNET_GNSRECORD_RF_PRIVATE; | ||
1237 | merge_with_nick_records(rlc->nick, rd_count, rd, &rdc_res, &rd_res); | ||
1238 | rlc->rd_ser_len = GNUNET_GNSRECORD_records_get_size(rdc_res, rd_res); | ||
1239 | if (rlc->rd_ser_len < 0) | ||
1240 | { | ||
1241 | GNUNET_break(0); | ||
1242 | GNUNET_free(rd_res); | ||
1243 | rlc->found = GNUNET_NO; | ||
1244 | rlc->rd_ser_len = 0; | ||
1245 | return; | ||
1246 | } | ||
1247 | rlc->res_rd_count = rdc_res; | ||
1248 | rlc->res_rd = GNUNET_malloc(rlc->rd_ser_len); | ||
1249 | if (rlc->rd_ser_len != GNUNET_GNSRECORD_records_serialize(rdc_res, | ||
1250 | rd_res, | ||
1251 | rlc->rd_ser_len, | ||
1252 | rlc->res_rd)) | ||
1253 | { | ||
1254 | GNUNET_break(0); | ||
1255 | GNUNET_free(rlc->res_rd); | ||
1256 | rlc->res_rd = NULL; | ||
1257 | rlc->res_rd_count = 0; | ||
1258 | rlc->rd_ser_len = 0; | ||
1259 | GNUNET_free(rd_res); | ||
1260 | rlc->found = GNUNET_NO; | ||
1261 | return; | ||
1262 | } | ||
1263 | GNUNET_free(rd_res); | ||
1264 | GNUNET_free(rlc->nick); | ||
1265 | rlc->nick = NULL; | ||
1286 | } | 1266 | } |
1287 | rlc->res_rd_count = rd_count; | 1267 | else |
1288 | rlc->res_rd = GNUNET_malloc (rlc->rd_ser_len); | ||
1289 | if (rlc->rd_ser_len != GNUNET_GNSRECORD_records_serialize (rd_count, | ||
1290 | rd, | ||
1291 | rlc->rd_ser_len, | ||
1292 | rlc->res_rd)) | ||
1293 | { | 1268 | { |
1294 | GNUNET_break (0); | 1269 | rlc->rd_ser_len = GNUNET_GNSRECORD_records_get_size(rd_count, rd); |
1295 | GNUNET_free (rlc->res_rd); | 1270 | if (rlc->rd_ser_len < 0) |
1296 | rlc->res_rd = NULL; | 1271 | { |
1297 | rlc->res_rd_count = 0; | 1272 | GNUNET_break(0); |
1298 | rlc->rd_ser_len = 0; | 1273 | rlc->found = GNUNET_NO; |
1299 | rlc->found = GNUNET_NO; | 1274 | rlc->rd_ser_len = 0; |
1300 | return; | 1275 | return; |
1276 | } | ||
1277 | rlc->res_rd_count = rd_count; | ||
1278 | rlc->res_rd = GNUNET_malloc(rlc->rd_ser_len); | ||
1279 | if (rlc->rd_ser_len != GNUNET_GNSRECORD_records_serialize(rd_count, | ||
1280 | rd, | ||
1281 | rlc->rd_ser_len, | ||
1282 | rlc->res_rd)) | ||
1283 | { | ||
1284 | GNUNET_break(0); | ||
1285 | GNUNET_free(rlc->res_rd); | ||
1286 | rlc->res_rd = NULL; | ||
1287 | rlc->res_rd_count = 0; | ||
1288 | rlc->rd_ser_len = 0; | ||
1289 | rlc->found = GNUNET_NO; | ||
1290 | return; | ||
1291 | } | ||
1301 | } | 1292 | } |
1302 | } | ||
1303 | } | 1293 | } |
1304 | 1294 | ||
1305 | 1295 | ||
@@ -1311,20 +1301,20 @@ lookup_it (void *cls, | |||
1311 | * @return #GNUNET_OK if @a ll_msg is well-formed | 1301 | * @return #GNUNET_OK if @a ll_msg is well-formed |
1312 | */ | 1302 | */ |
1313 | static int | 1303 | static int |
1314 | check_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | 1304 | check_record_lookup(void *cls, const struct LabelLookupMessage *ll_msg) |
1315 | { | 1305 | { |
1316 | uint32_t name_len; | 1306 | uint32_t name_len; |
1317 | size_t src_size; | 1307 | size_t src_size; |
1318 | 1308 | ||
1319 | (void) cls; | 1309 | (void)cls; |
1320 | name_len = ntohl (ll_msg->label_len); | 1310 | name_len = ntohl(ll_msg->label_len); |
1321 | src_size = ntohs (ll_msg->gns_header.header.size); | 1311 | src_size = ntohs(ll_msg->gns_header.header.size); |
1322 | if (name_len != src_size - sizeof (struct LabelLookupMessage)) | 1312 | if (name_len != src_size - sizeof(struct LabelLookupMessage)) |
1323 | { | 1313 | { |
1324 | GNUNET_break (0); | 1314 | GNUNET_break(0); |
1325 | return GNUNET_SYSERR; | 1315 | return GNUNET_SYSERR; |
1326 | } | 1316 | } |
1327 | GNUNET_MQ_check_zero_termination (ll_msg); | 1317 | GNUNET_MQ_check_zero_termination(ll_msg); |
1328 | return GNUNET_OK; | 1318 | return GNUNET_OK; |
1329 | } | 1319 | } |
1330 | 1320 | ||
@@ -1336,7 +1326,7 @@ check_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1336 | * @param ll_msg message of type `struct LabelLookupMessage` | 1326 | * @param ll_msg message of type `struct LabelLookupMessage` |
1337 | */ | 1327 | */ |
1338 | static void | 1328 | static void |
1339 | handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | 1329 | handle_record_lookup(void *cls, const struct LabelLookupMessage *ll_msg) |
1340 | { | 1330 | { |
1341 | struct NamestoreClient *nc = cls; | 1331 | struct NamestoreClient *nc = cls; |
1342 | struct GNUNET_MQ_Envelope *env; | 1332 | struct GNUNET_MQ_Envelope *env; |
@@ -1348,52 +1338,52 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1348 | uint32_t name_len; | 1338 | uint32_t name_len; |
1349 | int res; | 1339 | int res; |
1350 | 1340 | ||
1351 | name_len = ntohl (ll_msg->label_len); | 1341 | name_len = ntohl(ll_msg->label_len); |
1352 | name_tmp = (const char *) &ll_msg[1]; | 1342 | name_tmp = (const char *)&ll_msg[1]; |
1353 | GNUNET_SERVICE_client_continue (nc->client); | 1343 | GNUNET_SERVICE_client_continue(nc->client); |
1354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1344 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1355 | "Received NAMESTORE_RECORD_LOOKUP message for name `%s'\n", | 1345 | "Received NAMESTORE_RECORD_LOOKUP message for name `%s'\n", |
1356 | name_tmp); | 1346 | name_tmp); |
1357 | 1347 | ||
1358 | conv_name = GNUNET_GNSRECORD_string_to_lowercase (name_tmp); | 1348 | conv_name = GNUNET_GNSRECORD_string_to_lowercase(name_tmp); |
1359 | if (NULL == conv_name) | 1349 | if (NULL == conv_name) |
1360 | { | 1350 | { |
1361 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1351 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1362 | "Error converting name `%s'\n", | 1352 | "Error converting name `%s'\n", |
1363 | name_tmp); | 1353 | name_tmp); |
1364 | GNUNET_SERVICE_client_drop (nc->client); | 1354 | GNUNET_SERVICE_client_drop(nc->client); |
1365 | return; | 1355 | return; |
1366 | } | 1356 | } |
1367 | rlc.label = conv_name; | 1357 | rlc.label = conv_name; |
1368 | rlc.found = GNUNET_NO; | 1358 | rlc.found = GNUNET_NO; |
1369 | rlc.res_rd_count = 0; | 1359 | rlc.res_rd_count = 0; |
1370 | rlc.res_rd = NULL; | 1360 | rlc.res_rd = NULL; |
1371 | rlc.rd_ser_len = 0; | 1361 | rlc.rd_ser_len = 0; |
1372 | rlc.nick = get_nick_record (&ll_msg->zone); | 1362 | rlc.nick = get_nick_record(&ll_msg->zone); |
1373 | res = GSN_database->lookup_records (GSN_database->cls, | 1363 | res = GSN_database->lookup_records(GSN_database->cls, |
1374 | &ll_msg->zone, | 1364 | &ll_msg->zone, |
1375 | conv_name, | 1365 | conv_name, |
1376 | &lookup_it, | 1366 | &lookup_it, |
1377 | &rlc); | 1367 | &rlc); |
1378 | GNUNET_free (conv_name); | 1368 | GNUNET_free(conv_name); |
1379 | env = | 1369 | env = |
1380 | GNUNET_MQ_msg_extra (llr_msg, | 1370 | GNUNET_MQ_msg_extra(llr_msg, |
1381 | name_len + rlc.rd_ser_len, | 1371 | name_len + rlc.rd_ser_len, |
1382 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE); | 1372 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE); |
1383 | llr_msg->gns_header.r_id = ll_msg->gns_header.r_id; | 1373 | llr_msg->gns_header.r_id = ll_msg->gns_header.r_id; |
1384 | llr_msg->private_key = ll_msg->zone; | 1374 | llr_msg->private_key = ll_msg->zone; |
1385 | llr_msg->name_len = htons (name_len); | 1375 | llr_msg->name_len = htons(name_len); |
1386 | llr_msg->rd_count = htons (rlc.res_rd_count); | 1376 | llr_msg->rd_count = htons(rlc.res_rd_count); |
1387 | llr_msg->rd_len = htons (rlc.rd_ser_len); | 1377 | llr_msg->rd_len = htons(rlc.rd_ser_len); |
1388 | res_name = (char *) &llr_msg[1]; | 1378 | res_name = (char *)&llr_msg[1]; |
1389 | if ((GNUNET_YES == rlc.found) && (GNUNET_OK == res)) | 1379 | if ((GNUNET_YES == rlc.found) && (GNUNET_OK == res)) |
1390 | llr_msg->found = ntohs (GNUNET_YES); | 1380 | llr_msg->found = ntohs(GNUNET_YES); |
1391 | else | 1381 | else |
1392 | llr_msg->found = ntohs (GNUNET_NO); | 1382 | llr_msg->found = ntohs(GNUNET_NO); |
1393 | GNUNET_memcpy (&llr_msg[1], name_tmp, name_len); | 1383 | GNUNET_memcpy(&llr_msg[1], name_tmp, name_len); |
1394 | GNUNET_memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len); | 1384 | GNUNET_memcpy(&res_name[name_len], rlc.res_rd, rlc.rd_ser_len); |
1395 | GNUNET_MQ_send (nc->mq, env); | 1385 | GNUNET_MQ_send(nc->mq, env); |
1396 | GNUNET_free_non_null (rlc.res_rd); | 1386 | GNUNET_free_non_null(rlc.res_rd); |
1397 | } | 1387 | } |
1398 | 1388 | ||
1399 | 1389 | ||
@@ -1405,7 +1395,7 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg) | |||
1405 | * @return #GNUNET_OK if @a rp_msg is well-formed | 1395 | * @return #GNUNET_OK if @a rp_msg is well-formed |
1406 | */ | 1396 | */ |
1407 | static int | 1397 | static int |
1408 | check_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | 1398 | check_record_store(void *cls, const struct RecordStoreMessage *rp_msg) |
1409 | { | 1399 | { |
1410 | size_t name_len; | 1400 | size_t name_len; |
1411 | size_t msg_size; | 1401 | size_t msg_size; |
@@ -1413,27 +1403,27 @@ check_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1413 | size_t rd_ser_len; | 1403 | size_t rd_ser_len; |
1414 | const char *name_tmp; | 1404 | const char *name_tmp; |
1415 | 1405 | ||
1416 | (void) cls; | 1406 | (void)cls; |
1417 | name_len = ntohs (rp_msg->name_len); | 1407 | name_len = ntohs(rp_msg->name_len); |
1418 | msg_size = ntohs (rp_msg->gns_header.header.size); | 1408 | msg_size = ntohs(rp_msg->gns_header.header.size); |
1419 | rd_ser_len = ntohs (rp_msg->rd_len); | 1409 | rd_ser_len = ntohs(rp_msg->rd_len); |
1420 | msg_size_exp = sizeof (struct RecordStoreMessage) + name_len + rd_ser_len; | 1410 | msg_size_exp = sizeof(struct RecordStoreMessage) + name_len + rd_ser_len; |
1421 | if (msg_size != msg_size_exp) | 1411 | if (msg_size != msg_size_exp) |
1422 | { | 1412 | { |
1423 | GNUNET_break (0); | 1413 | GNUNET_break(0); |
1424 | return GNUNET_SYSERR; | 1414 | return GNUNET_SYSERR; |
1425 | } | 1415 | } |
1426 | if ((0 == name_len) || (name_len > MAX_NAME_LEN)) | 1416 | if ((0 == name_len) || (name_len > MAX_NAME_LEN)) |
1427 | { | 1417 | { |
1428 | GNUNET_break (0); | 1418 | GNUNET_break(0); |
1429 | return GNUNET_SYSERR; | 1419 | return GNUNET_SYSERR; |
1430 | } | 1420 | } |
1431 | name_tmp = (const char *) &rp_msg[1]; | 1421 | name_tmp = (const char *)&rp_msg[1]; |
1432 | if ('\0' != name_tmp[name_len - 1]) | 1422 | if ('\0' != name_tmp[name_len - 1]) |
1433 | { | 1423 | { |
1434 | GNUNET_break (0); | 1424 | GNUNET_break(0); |
1435 | return GNUNET_SYSERR; | 1425 | return GNUNET_SYSERR; |
1436 | } | 1426 | } |
1437 | return GNUNET_OK; | 1427 | return GNUNET_OK; |
1438 | } | 1428 | } |
1439 | 1429 | ||
@@ -1445,7 +1435,7 @@ check_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1445 | * @param rp_msg message of type `struct RecordStoreMessage` | 1435 | * @param rp_msg message of type `struct RecordStoreMessage` |
1446 | */ | 1436 | */ |
1447 | static void | 1437 | static void |
1448 | handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | 1438 | handle_record_store(void *cls, const struct RecordStoreMessage *rp_msg) |
1449 | { | 1439 | { |
1450 | struct NamestoreClient *nc = cls; | 1440 | struct NamestoreClient *nc = cls; |
1451 | size_t name_len; | 1441 | size_t name_len; |
@@ -1458,112 +1448,112 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1458 | int res; | 1448 | int res; |
1459 | struct StoreActivity *sa; | 1449 | struct StoreActivity *sa; |
1460 | 1450 | ||
1461 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1451 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1462 | "Received NAMESTORE_RECORD_STORE message\n"); | 1452 | "Received NAMESTORE_RECORD_STORE message\n"); |
1463 | rid = ntohl (rp_msg->gns_header.r_id); | 1453 | rid = ntohl(rp_msg->gns_header.r_id); |
1464 | name_len = ntohs (rp_msg->name_len); | 1454 | name_len = ntohs(rp_msg->name_len); |
1465 | rd_count = ntohs (rp_msg->rd_count); | 1455 | rd_count = ntohs(rp_msg->rd_count); |
1466 | rd_ser_len = ntohs (rp_msg->rd_len); | 1456 | rd_ser_len = ntohs(rp_msg->rd_len); |
1467 | GNUNET_break (0 == ntohs (rp_msg->reserved)); | 1457 | GNUNET_break(0 == ntohs(rp_msg->reserved)); |
1468 | name_tmp = (const char *) &rp_msg[1]; | 1458 | name_tmp = (const char *)&rp_msg[1]; |
1469 | rd_ser = &name_tmp[name_len]; | 1459 | rd_ser = &name_tmp[name_len]; |
1470 | { | 1460 | { |
1471 | struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL (rd_count)]; | 1461 | struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL(rd_count)]; |
1472 | 1462 | ||
1473 | if (GNUNET_OK != | 1463 | if (GNUNET_OK != |
1474 | GNUNET_GNSRECORD_records_deserialize (rd_ser_len, rd_ser, rd_count, rd)) | 1464 | GNUNET_GNSRECORD_records_deserialize(rd_ser_len, rd_ser, rd_count, rd)) |
1475 | { | 1465 | { |
1476 | GNUNET_break (0); | 1466 | GNUNET_break(0); |
1477 | GNUNET_SERVICE_client_drop (nc->client); | 1467 | GNUNET_SERVICE_client_drop(nc->client); |
1478 | return; | 1468 | return; |
1479 | } | 1469 | } |
1480 | 1470 | ||
1481 | /* Extracting and converting private key */ | 1471 | /* Extracting and converting private key */ |
1482 | conv_name = GNUNET_GNSRECORD_string_to_lowercase (name_tmp); | 1472 | conv_name = GNUNET_GNSRECORD_string_to_lowercase(name_tmp); |
1483 | if (NULL == conv_name) | 1473 | if (NULL == conv_name) |
1484 | { | 1474 | { |
1485 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1475 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1486 | "Error converting name `%s'\n", | 1476 | "Error converting name `%s'\n", |
1487 | name_tmp); | 1477 | name_tmp); |
1488 | GNUNET_SERVICE_client_drop (nc->client); | 1478 | GNUNET_SERVICE_client_drop(nc->client); |
1489 | return; | 1479 | return; |
1490 | } | 1480 | } |
1491 | GNUNET_STATISTICS_update (statistics, | 1481 | GNUNET_STATISTICS_update(statistics, |
1492 | "Well-formed store requests received", | 1482 | "Well-formed store requests received", |
1493 | 1, | 1483 | 1, |
1494 | GNUNET_NO); | 1484 | GNUNET_NO); |
1495 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1485 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1496 | "Creating %u records for name `%s'\n", | 1486 | "Creating %u records for name `%s'\n", |
1497 | (unsigned int) rd_count, | 1487 | (unsigned int)rd_count, |
1498 | conv_name); | 1488 | conv_name); |
1499 | if ((0 == rd_count) && | 1489 | if ((0 == rd_count) && |
1500 | (GNUNET_NO == GSN_database->lookup_records (GSN_database->cls, | 1490 | (GNUNET_NO == GSN_database->lookup_records(GSN_database->cls, |
1501 | &rp_msg->private_key, | 1491 | &rp_msg->private_key, |
1502 | conv_name, | 1492 | conv_name, |
1503 | NULL, | 1493 | NULL, |
1504 | 0))) | 1494 | 0))) |
1505 | { | ||
1506 | /* This name does not exist, so cannot be removed */ | ||
1507 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1508 | "Name `%s' does not exist, no deletion required\n", | ||
1509 | conv_name); | ||
1510 | res = GNUNET_NO; | ||
1511 | } | ||
1512 | else | ||
1513 | { | ||
1514 | /* remove "NICK" records, unless this is for the | ||
1515 | #GNUNET_GNS_EMPTY_LABEL_AT label */ | ||
1516 | struct GNUNET_GNSRECORD_Data rd_clean[GNUNET_NZL (rd_count)]; | ||
1517 | unsigned int rd_clean_off; | ||
1518 | int have_nick; | ||
1519 | |||
1520 | rd_clean_off = 0; | ||
1521 | have_nick = GNUNET_NO; | ||
1522 | for (unsigned int i = 0; i < rd_count; i++) | ||
1523 | { | 1495 | { |
1524 | rd_clean[rd_clean_off] = rd[i]; | 1496 | /* This name does not exist, so cannot be removed */ |
1525 | if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) || | 1497 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1526 | (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type)) | 1498 | "Name `%s' does not exist, no deletion required\n", |
1527 | rd_clean_off++; | 1499 | conv_name); |
1528 | 1500 | res = GNUNET_NO; | |
1529 | if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) && | ||
1530 | (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type)) | ||
1531 | { | ||
1532 | cache_nick (&rp_msg->private_key, &rd[i]); | ||
1533 | have_nick = GNUNET_YES; | ||
1534 | } | ||
1535 | } | 1501 | } |
1536 | if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) && | 1502 | else |
1537 | (GNUNET_NO == have_nick)) | ||
1538 | { | 1503 | { |
1539 | /* remove nick record from cache, in case we have one there */ | 1504 | /* remove "NICK" records, unless this is for the |
1540 | cache_nick (&rp_msg->private_key, NULL); | 1505 | #GNUNET_GNS_EMPTY_LABEL_AT label */ |
1506 | struct GNUNET_GNSRECORD_Data rd_clean[GNUNET_NZL(rd_count)]; | ||
1507 | unsigned int rd_clean_off; | ||
1508 | int have_nick; | ||
1509 | |||
1510 | rd_clean_off = 0; | ||
1511 | have_nick = GNUNET_NO; | ||
1512 | for (unsigned int i = 0; i < rd_count; i++) | ||
1513 | { | ||
1514 | rd_clean[rd_clean_off] = rd[i]; | ||
1515 | if ((0 == strcmp(GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) || | ||
1516 | (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type)) | ||
1517 | rd_clean_off++; | ||
1518 | |||
1519 | if ((0 == strcmp(GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) && | ||
1520 | (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type)) | ||
1521 | { | ||
1522 | cache_nick(&rp_msg->private_key, &rd[i]); | ||
1523 | have_nick = GNUNET_YES; | ||
1524 | } | ||
1525 | } | ||
1526 | if ((0 == strcmp(GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) && | ||
1527 | (GNUNET_NO == have_nick)) | ||
1528 | { | ||
1529 | /* remove nick record from cache, in case we have one there */ | ||
1530 | cache_nick(&rp_msg->private_key, NULL); | ||
1531 | } | ||
1532 | res = GSN_database->store_records(GSN_database->cls, | ||
1533 | &rp_msg->private_key, | ||
1534 | conv_name, | ||
1535 | rd_clean_off, | ||
1536 | rd_clean); | ||
1541 | } | 1537 | } |
1542 | res = GSN_database->store_records (GSN_database->cls, | ||
1543 | &rp_msg->private_key, | ||
1544 | conv_name, | ||
1545 | rd_clean_off, | ||
1546 | rd_clean); | ||
1547 | } | ||
1548 | 1538 | ||
1549 | if (GNUNET_OK != res) | 1539 | if (GNUNET_OK != res) |
1550 | { | 1540 | { |
1551 | /* store not successful, not need to tell monitors */ | 1541 | /* store not successful, not need to tell monitors */ |
1552 | send_store_response (nc, res, rid); | 1542 | send_store_response(nc, res, rid); |
1553 | GNUNET_SERVICE_client_continue (nc->client); | 1543 | GNUNET_SERVICE_client_continue(nc->client); |
1554 | GNUNET_free (conv_name); | 1544 | GNUNET_free(conv_name); |
1555 | return; | 1545 | return; |
1556 | } | 1546 | } |
1557 | 1547 | ||
1558 | sa = GNUNET_malloc (sizeof (struct StoreActivity) + | 1548 | sa = GNUNET_malloc(sizeof(struct StoreActivity) + |
1559 | ntohs (rp_msg->gns_header.header.size)); | 1549 | ntohs(rp_msg->gns_header.header.size)); |
1560 | GNUNET_CONTAINER_DLL_insert (sa_head, sa_tail, sa); | 1550 | GNUNET_CONTAINER_DLL_insert(sa_head, sa_tail, sa); |
1561 | sa->nc = nc; | 1551 | sa->nc = nc; |
1562 | sa->rsm = (const struct RecordStoreMessage *) &sa[1]; | 1552 | sa->rsm = (const struct RecordStoreMessage *)&sa[1]; |
1563 | GNUNET_memcpy (&sa[1], rp_msg, ntohs (rp_msg->gns_header.header.size)); | 1553 | GNUNET_memcpy(&sa[1], rp_msg, ntohs(rp_msg->gns_header.header.size)); |
1564 | sa->zm_pos = monitor_head; | 1554 | sa->zm_pos = monitor_head; |
1565 | sa->conv_name = conv_name; | 1555 | sa->conv_name = conv_name; |
1566 | continue_store_activity (sa); | 1556 | continue_store_activity(sa); |
1567 | } | 1557 | } |
1568 | } | 1558 | } |
1569 | 1559 | ||
@@ -1572,8 +1562,7 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1572 | * Context for record remove operations passed from #handle_zone_to_name to | 1562 | * Context for record remove operations passed from #handle_zone_to_name to |
1573 | * #handle_zone_to_name_it as closure | 1563 | * #handle_zone_to_name_it as closure |
1574 | */ | 1564 | */ |
1575 | struct ZoneToNameCtx | 1565 | struct ZoneToNameCtx { |
1576 | { | ||
1577 | /** | 1566 | /** |
1578 | * Namestore client | 1567 | * Namestore client |
1579 | */ | 1568 | */ |
@@ -1604,12 +1593,12 @@ struct ZoneToNameCtx | |||
1604 | * @param rd record data | 1593 | * @param rd record data |
1605 | */ | 1594 | */ |
1606 | static void | 1595 | static void |
1607 | handle_zone_to_name_it (void *cls, | 1596 | handle_zone_to_name_it(void *cls, |
1608 | uint64_t seq, | 1597 | uint64_t seq, |
1609 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 1598 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
1610 | const char *name, | 1599 | const char *name, |
1611 | unsigned int rd_count, | 1600 | unsigned int rd_count, |
1612 | const struct GNUNET_GNSRECORD_Data *rd) | 1601 | const struct GNUNET_GNSRECORD_Data *rd) |
1613 | { | 1602 | { |
1614 | struct ZoneToNameCtx *ztn_ctx = cls; | 1603 | struct ZoneToNameCtx *ztn_ctx = cls; |
1615 | struct GNUNET_MQ_Envelope *env; | 1604 | struct GNUNET_MQ_Envelope *env; |
@@ -1621,45 +1610,45 @@ handle_zone_to_name_it (void *cls, | |||
1621 | char *name_tmp; | 1610 | char *name_tmp; |
1622 | char *rd_tmp; | 1611 | char *rd_tmp; |
1623 | 1612 | ||
1624 | GNUNET_assert (0 != seq); | 1613 | GNUNET_assert(0 != seq); |
1625 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1614 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1626 | "Found result for zone-to-name lookup: `%s'\n", | 1615 | "Found result for zone-to-name lookup: `%s'\n", |
1627 | name); | 1616 | name); |
1628 | res = GNUNET_YES; | 1617 | res = GNUNET_YES; |
1629 | name_len = (NULL == name) ? 0 : strlen (name) + 1; | 1618 | name_len = (NULL == name) ? 0 : strlen(name) + 1; |
1630 | rd_ser_len = GNUNET_GNSRECORD_records_get_size (rd_count, rd); | 1619 | rd_ser_len = GNUNET_GNSRECORD_records_get_size(rd_count, rd); |
1631 | if (rd_ser_len < 0) | 1620 | if (rd_ser_len < 0) |
1632 | { | 1621 | { |
1633 | GNUNET_break (0); | 1622 | GNUNET_break(0); |
1634 | ztn_ctx->success = GNUNET_SYSERR; | 1623 | ztn_ctx->success = GNUNET_SYSERR; |
1635 | return; | 1624 | return; |
1636 | } | 1625 | } |
1637 | msg_size = sizeof (struct ZoneToNameResponseMessage) + name_len + rd_ser_len; | 1626 | msg_size = sizeof(struct ZoneToNameResponseMessage) + name_len + rd_ser_len; |
1638 | if (msg_size >= GNUNET_MAX_MESSAGE_SIZE) | 1627 | if (msg_size >= GNUNET_MAX_MESSAGE_SIZE) |
1639 | { | 1628 | { |
1640 | GNUNET_break (0); | 1629 | GNUNET_break(0); |
1641 | ztn_ctx->success = GNUNET_SYSERR; | 1630 | ztn_ctx->success = GNUNET_SYSERR; |
1642 | return; | 1631 | return; |
1643 | } | 1632 | } |
1644 | env = | 1633 | env = |
1645 | GNUNET_MQ_msg_extra (ztnr_msg, | 1634 | GNUNET_MQ_msg_extra(ztnr_msg, |
1646 | name_len + rd_ser_len, | 1635 | name_len + rd_ser_len, |
1647 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE); | 1636 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE); |
1648 | ztnr_msg->gns_header.header.size = htons (msg_size); | 1637 | ztnr_msg->gns_header.header.size = htons(msg_size); |
1649 | ztnr_msg->gns_header.r_id = htonl (ztn_ctx->rid); | 1638 | ztnr_msg->gns_header.r_id = htonl(ztn_ctx->rid); |
1650 | ztnr_msg->res = htons (res); | 1639 | ztnr_msg->res = htons(res); |
1651 | ztnr_msg->rd_len = htons (rd_ser_len); | 1640 | ztnr_msg->rd_len = htons(rd_ser_len); |
1652 | ztnr_msg->rd_count = htons (rd_count); | 1641 | ztnr_msg->rd_count = htons(rd_count); |
1653 | ztnr_msg->name_len = htons (name_len); | 1642 | ztnr_msg->name_len = htons(name_len); |
1654 | ztnr_msg->zone = *zone_key; | 1643 | ztnr_msg->zone = *zone_key; |
1655 | name_tmp = (char *) &ztnr_msg[1]; | 1644 | name_tmp = (char *)&ztnr_msg[1]; |
1656 | GNUNET_memcpy (name_tmp, name, name_len); | 1645 | GNUNET_memcpy(name_tmp, name, name_len); |
1657 | rd_tmp = &name_tmp[name_len]; | 1646 | rd_tmp = &name_tmp[name_len]; |
1658 | GNUNET_assert ( | 1647 | GNUNET_assert( |
1659 | rd_ser_len == | 1648 | rd_ser_len == |
1660 | GNUNET_GNSRECORD_records_serialize (rd_count, rd, rd_ser_len, rd_tmp)); | 1649 | GNUNET_GNSRECORD_records_serialize(rd_count, rd, rd_ser_len, rd_tmp)); |
1661 | ztn_ctx->success = GNUNET_OK; | 1650 | ztn_ctx->success = GNUNET_OK; |
1662 | GNUNET_MQ_send (ztn_ctx->nc->mq, env); | 1651 | GNUNET_MQ_send(ztn_ctx->nc->mq, env); |
1663 | } | 1652 | } |
1664 | 1653 | ||
1665 | 1654 | ||
@@ -1670,41 +1659,41 @@ handle_zone_to_name_it (void *cls, | |||
1670 | * @param ztn_msg message of type 'struct ZoneToNameMessage' | 1659 | * @param ztn_msg message of type 'struct ZoneToNameMessage' |
1671 | */ | 1660 | */ |
1672 | static void | 1661 | static void |
1673 | handle_zone_to_name (void *cls, const struct ZoneToNameMessage *ztn_msg) | 1662 | handle_zone_to_name(void *cls, const struct ZoneToNameMessage *ztn_msg) |
1674 | { | 1663 | { |
1675 | struct NamestoreClient *nc = cls; | 1664 | struct NamestoreClient *nc = cls; |
1676 | struct ZoneToNameCtx ztn_ctx; | 1665 | struct ZoneToNameCtx ztn_ctx; |
1677 | struct GNUNET_MQ_Envelope *env; | 1666 | struct GNUNET_MQ_Envelope *env; |
1678 | struct ZoneToNameResponseMessage *ztnr_msg; | 1667 | struct ZoneToNameResponseMessage *ztnr_msg; |
1679 | 1668 | ||
1680 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME message\n"); | 1669 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME message\n"); |
1681 | ztn_ctx.rid = ntohl (ztn_msg->gns_header.r_id); | 1670 | ztn_ctx.rid = ntohl(ztn_msg->gns_header.r_id); |
1682 | ztn_ctx.nc = nc; | 1671 | ztn_ctx.nc = nc; |
1683 | ztn_ctx.success = GNUNET_NO; | 1672 | ztn_ctx.success = GNUNET_NO; |
1684 | if (GNUNET_SYSERR == GSN_database->zone_to_name (GSN_database->cls, | 1673 | if (GNUNET_SYSERR == GSN_database->zone_to_name(GSN_database->cls, |
1685 | &ztn_msg->zone, | 1674 | &ztn_msg->zone, |
1686 | &ztn_msg->value_zone, | 1675 | &ztn_msg->value_zone, |
1687 | &handle_zone_to_name_it, | 1676 | &handle_zone_to_name_it, |
1688 | &ztn_ctx)) | 1677 | &ztn_ctx)) |
1689 | { | 1678 | { |
1690 | /* internal error, hang up instead of signalling something | 1679 | /* internal error, hang up instead of signalling something |
1691 | that might be wrong */ | 1680 | that might be wrong */ |
1692 | GNUNET_break (0); | 1681 | GNUNET_break(0); |
1693 | GNUNET_SERVICE_client_drop (nc->client); | 1682 | GNUNET_SERVICE_client_drop(nc->client); |
1694 | return; | 1683 | return; |
1695 | } | 1684 | } |
1696 | if (GNUNET_NO == ztn_ctx.success) | 1685 | if (GNUNET_NO == ztn_ctx.success) |
1697 | { | 1686 | { |
1698 | /* no result found, send empty response */ | 1687 | /* no result found, send empty response */ |
1699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1688 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1700 | "Found no result for zone-to-name lookup.\n"); | 1689 | "Found no result for zone-to-name lookup.\n"); |
1701 | env = GNUNET_MQ_msg (ztnr_msg, | 1690 | env = GNUNET_MQ_msg(ztnr_msg, |
1702 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE); | 1691 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE); |
1703 | ztnr_msg->gns_header.r_id = ztn_msg->gns_header.r_id; | 1692 | ztnr_msg->gns_header.r_id = ztn_msg->gns_header.r_id; |
1704 | ztnr_msg->res = htons (GNUNET_NO); | 1693 | ztnr_msg->res = htons(GNUNET_NO); |
1705 | GNUNET_MQ_send (nc->mq, env); | 1694 | GNUNET_MQ_send(nc->mq, env); |
1706 | } | 1695 | } |
1707 | GNUNET_SERVICE_client_continue (nc->client); | 1696 | GNUNET_SERVICE_client_continue(nc->client); |
1708 | } | 1697 | } |
1709 | 1698 | ||
1710 | 1699 | ||
@@ -1712,8 +1701,7 @@ handle_zone_to_name (void *cls, const struct ZoneToNameMessage *ztn_msg) | |||
1712 | * Context for record remove operations passed from | 1701 | * Context for record remove operations passed from |
1713 | * #run_zone_iteration_round to #zone_iterate_proc as closure | 1702 | * #run_zone_iteration_round to #zone_iterate_proc as closure |
1714 | */ | 1703 | */ |
1715 | struct ZoneIterationProcResult | 1704 | struct ZoneIterationProcResult { |
1716 | { | ||
1717 | /** | 1705 | /** |
1718 | * The zone iteration handle | 1706 | * The zone iteration handle |
1719 | */ | 1707 | */ |
@@ -1737,53 +1725,53 @@ struct ZoneIterationProcResult | |||
1737 | * @param rd record data | 1725 | * @param rd record data |
1738 | */ | 1726 | */ |
1739 | static void | 1727 | static void |
1740 | zone_iterate_proc (void *cls, | 1728 | zone_iterate_proc(void *cls, |
1741 | uint64_t seq, | 1729 | uint64_t seq, |
1742 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 1730 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
1743 | const char *name, | 1731 | const char *name, |
1744 | unsigned int rd_count, | 1732 | unsigned int rd_count, |
1745 | const struct GNUNET_GNSRECORD_Data *rd) | 1733 | const struct GNUNET_GNSRECORD_Data *rd) |
1746 | { | 1734 | { |
1747 | struct ZoneIterationProcResult *proc = cls; | 1735 | struct ZoneIterationProcResult *proc = cls; |
1748 | int do_refresh_block; | 1736 | int do_refresh_block; |
1749 | 1737 | ||
1750 | GNUNET_assert (0 != seq); | 1738 | GNUNET_assert(0 != seq); |
1751 | if ((NULL == zone_key) && (NULL == name)) | 1739 | if ((NULL == zone_key) && (NULL == name)) |
1752 | { | 1740 | { |
1753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Iteration done\n"); | 1741 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Iteration done\n"); |
1754 | return; | 1742 | return; |
1755 | } | 1743 | } |
1756 | if ((NULL == zone_key) || (NULL == name)) | 1744 | if ((NULL == zone_key) || (NULL == name)) |
1757 | { | 1745 | { |
1758 | /* what is this!? should never happen */ | 1746 | /* what is this!? should never happen */ |
1759 | GNUNET_break (0); | 1747 | GNUNET_break(0); |
1760 | return; | 1748 | return; |
1761 | } | 1749 | } |
1762 | if (0 == proc->limit) | 1750 | if (0 == proc->limit) |
1763 | { | 1751 | { |
1764 | /* what is this!? should never happen */ | 1752 | /* what is this!? should never happen */ |
1765 | GNUNET_break (0); | 1753 | GNUNET_break(0); |
1766 | return; | 1754 | return; |
1767 | } | 1755 | } |
1768 | proc->limit--; | 1756 | proc->limit--; |
1769 | proc->zi->seq = seq; | 1757 | proc->zi->seq = seq; |
1770 | send_lookup_response (proc->zi->nc, | 1758 | send_lookup_response(proc->zi->nc, |
1771 | proc->zi->request_id, | 1759 | proc->zi->request_id, |
1772 | zone_key, | 1760 | zone_key, |
1773 | name, | 1761 | name, |
1774 | rd_count, | 1762 | rd_count, |
1775 | rd); | 1763 | rd); |
1776 | 1764 | ||
1777 | 1765 | ||
1778 | do_refresh_block = GNUNET_NO; | 1766 | do_refresh_block = GNUNET_NO; |
1779 | for (unsigned int i = 0; i < rd_count; i++) | 1767 | for (unsigned int i = 0; i < rd_count; i++) |
1780 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | 1768 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) |
1781 | { | 1769 | { |
1782 | do_refresh_block = GNUNET_YES; | 1770 | do_refresh_block = GNUNET_YES; |
1783 | break; | 1771 | break; |
1784 | } | 1772 | } |
1785 | if (GNUNET_YES == do_refresh_block) | 1773 | if (GNUNET_YES == do_refresh_block) |
1786 | refresh_block (NULL, proc->zi, 0, zone_key, name, rd_count, rd); | 1774 | refresh_block(NULL, proc->zi, 0, zone_key, name, rd_count, rd); |
1787 | } | 1775 | } |
1788 | 1776 | ||
1789 | 1777 | ||
@@ -1794,42 +1782,42 @@ zone_iterate_proc (void *cls, | |||
1794 | * @param limit number of results to return in one pass | 1782 | * @param limit number of results to return in one pass |
1795 | */ | 1783 | */ |
1796 | static void | 1784 | static void |
1797 | run_zone_iteration_round (struct ZoneIteration *zi, uint64_t limit) | 1785 | run_zone_iteration_round(struct ZoneIteration *zi, uint64_t limit) |
1798 | { | 1786 | { |
1799 | struct ZoneIterationProcResult proc; | 1787 | struct ZoneIterationProcResult proc; |
1800 | struct GNUNET_TIME_Absolute start; | 1788 | struct GNUNET_TIME_Absolute start; |
1801 | struct GNUNET_TIME_Relative duration; | 1789 | struct GNUNET_TIME_Relative duration; |
1802 | 1790 | ||
1803 | memset (&proc, 0, sizeof (proc)); | 1791 | memset(&proc, 0, sizeof(proc)); |
1804 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1792 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1805 | "Asked to return up to %llu records at position %llu\n", | 1793 | "Asked to return up to %llu records at position %llu\n", |
1806 | (unsigned long long) limit, | 1794 | (unsigned long long)limit, |
1807 | (unsigned long long) zi->seq); | 1795 | (unsigned long long)zi->seq); |
1808 | proc.zi = zi; | 1796 | proc.zi = zi; |
1809 | proc.limit = limit; | 1797 | proc.limit = limit; |
1810 | start = GNUNET_TIME_absolute_get (); | 1798 | start = GNUNET_TIME_absolute_get(); |
1811 | GNUNET_break (GNUNET_SYSERR != | 1799 | GNUNET_break(GNUNET_SYSERR != |
1812 | GSN_database->iterate_records (GSN_database->cls, | 1800 | GSN_database->iterate_records(GSN_database->cls, |
1813 | (0 == GNUNET_is_zero (&zi->zone)) | 1801 | (0 == GNUNET_is_zero(&zi->zone)) |
1814 | ? NULL | 1802 | ? NULL |
1815 | : &zi->zone, | 1803 | : &zi->zone, |
1816 | zi->seq, | 1804 | zi->seq, |
1817 | limit, | 1805 | limit, |
1818 | &zone_iterate_proc, | 1806 | &zone_iterate_proc, |
1819 | &proc)); | 1807 | &proc)); |
1820 | duration = GNUNET_TIME_absolute_get_duration (start); | 1808 | duration = GNUNET_TIME_absolute_get_duration(start); |
1821 | duration = GNUNET_TIME_relative_divide (duration, limit - proc.limit); | 1809 | duration = GNUNET_TIME_relative_divide(duration, limit - proc.limit); |
1822 | GNUNET_STATISTICS_set (statistics, | 1810 | GNUNET_STATISTICS_set(statistics, |
1823 | "NAMESTORE iteration delay (μs/record)", | 1811 | "NAMESTORE iteration delay (μs/record)", |
1824 | duration.rel_value_us, | 1812 | duration.rel_value_us, |
1825 | GNUNET_NO); | 1813 | GNUNET_NO); |
1826 | if (0 == proc.limit) | 1814 | if (0 == proc.limit) |
1827 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1815 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1828 | "Returned %llu results, more results available\n", | 1816 | "Returned %llu results, more results available\n", |
1829 | (unsigned long long) limit); | 1817 | (unsigned long long)limit); |
1830 | zi->send_end = (0 != proc.limit); | 1818 | zi->send_end = (0 != proc.limit); |
1831 | if (0 == zi->cache_ops) | 1819 | if (0 == zi->cache_ops) |
1832 | zone_iteration_done_client_continue (zi); | 1820 | zone_iteration_done_client_continue(zi); |
1833 | } | 1821 | } |
1834 | 1822 | ||
1835 | 1823 | ||
@@ -1840,22 +1828,22 @@ run_zone_iteration_round (struct ZoneIteration *zi, uint64_t limit) | |||
1840 | * @param zis_msg message from the client | 1828 | * @param zis_msg message from the client |
1841 | */ | 1829 | */ |
1842 | static void | 1830 | static void |
1843 | handle_iteration_start (void *cls, | 1831 | handle_iteration_start(void *cls, |
1844 | const struct ZoneIterationStartMessage *zis_msg) | 1832 | const struct ZoneIterationStartMessage *zis_msg) |
1845 | { | 1833 | { |
1846 | struct NamestoreClient *nc = cls; | 1834 | struct NamestoreClient *nc = cls; |
1847 | struct ZoneIteration *zi; | 1835 | struct ZoneIteration *zi; |
1848 | 1836 | ||
1849 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1837 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1850 | "Received ZONE_ITERATION_START message\n"); | 1838 | "Received ZONE_ITERATION_START message\n"); |
1851 | zi = GNUNET_new (struct ZoneIteration); | 1839 | zi = GNUNET_new(struct ZoneIteration); |
1852 | zi->request_id = ntohl (zis_msg->gns_header.r_id); | 1840 | zi->request_id = ntohl(zis_msg->gns_header.r_id); |
1853 | zi->offset = 0; | 1841 | zi->offset = 0; |
1854 | zi->nc = nc; | 1842 | zi->nc = nc; |
1855 | zi->zone = zis_msg->zone; | 1843 | zi->zone = zis_msg->zone; |
1856 | 1844 | ||
1857 | GNUNET_CONTAINER_DLL_insert (nc->op_head, nc->op_tail, zi); | 1845 | GNUNET_CONTAINER_DLL_insert(nc->op_head, nc->op_tail, zi); |
1858 | run_zone_iteration_round (zi, 1); | 1846 | run_zone_iteration_round(zi, 1); |
1859 | } | 1847 | } |
1860 | 1848 | ||
1861 | 1849 | ||
@@ -1866,28 +1854,28 @@ handle_iteration_start (void *cls, | |||
1866 | * @param zis_msg message from the client | 1854 | * @param zis_msg message from the client |
1867 | */ | 1855 | */ |
1868 | static void | 1856 | static void |
1869 | handle_iteration_stop (void *cls, | 1857 | handle_iteration_stop(void *cls, |
1870 | const struct ZoneIterationStopMessage *zis_msg) | 1858 | const struct ZoneIterationStopMessage *zis_msg) |
1871 | { | 1859 | { |
1872 | struct NamestoreClient *nc = cls; | 1860 | struct NamestoreClient *nc = cls; |
1873 | struct ZoneIteration *zi; | 1861 | struct ZoneIteration *zi; |
1874 | uint32_t rid; | 1862 | uint32_t rid; |
1875 | 1863 | ||
1876 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1864 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1877 | "Received ZONE_ITERATION_STOP message\n"); | 1865 | "Received ZONE_ITERATION_STOP message\n"); |
1878 | rid = ntohl (zis_msg->gns_header.r_id); | 1866 | rid = ntohl(zis_msg->gns_header.r_id); |
1879 | for (zi = nc->op_head; NULL != zi; zi = zi->next) | 1867 | for (zi = nc->op_head; NULL != zi; zi = zi->next) |
1880 | if (zi->request_id == rid) | 1868 | if (zi->request_id == rid) |
1881 | break; | 1869 | break; |
1882 | if (NULL == zi) | 1870 | if (NULL == zi) |
1883 | { | 1871 | { |
1884 | GNUNET_break (0); | 1872 | GNUNET_break(0); |
1885 | GNUNET_SERVICE_client_drop (nc->client); | 1873 | GNUNET_SERVICE_client_drop(nc->client); |
1886 | return; | 1874 | return; |
1887 | } | 1875 | } |
1888 | GNUNET_CONTAINER_DLL_remove (nc->op_head, nc->op_tail, zi); | 1876 | GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, zi); |
1889 | GNUNET_free (zi); | 1877 | GNUNET_free(zi); |
1890 | GNUNET_SERVICE_client_continue (nc->client); | 1878 | GNUNET_SERVICE_client_continue(nc->client); |
1891 | } | 1879 | } |
1892 | 1880 | ||
1893 | 1881 | ||
@@ -1898,32 +1886,32 @@ handle_iteration_stop (void *cls, | |||
1898 | * @param message message from the client | 1886 | * @param message message from the client |
1899 | */ | 1887 | */ |
1900 | static void | 1888 | static void |
1901 | handle_iteration_next (void *cls, | 1889 | handle_iteration_next(void *cls, |
1902 | const struct ZoneIterationNextMessage *zis_msg) | 1890 | const struct ZoneIterationNextMessage *zis_msg) |
1903 | { | 1891 | { |
1904 | struct NamestoreClient *nc = cls; | 1892 | struct NamestoreClient *nc = cls; |
1905 | struct ZoneIteration *zi; | 1893 | struct ZoneIteration *zi; |
1906 | uint32_t rid; | 1894 | uint32_t rid; |
1907 | uint64_t limit; | 1895 | uint64_t limit; |
1908 | 1896 | ||
1909 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1897 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1910 | "Received ZONE_ITERATION_NEXT message\n"); | 1898 | "Received ZONE_ITERATION_NEXT message\n"); |
1911 | GNUNET_STATISTICS_update (statistics, | 1899 | GNUNET_STATISTICS_update(statistics, |
1912 | "Iteration NEXT messages received", | 1900 | "Iteration NEXT messages received", |
1913 | 1, | 1901 | 1, |
1914 | GNUNET_NO); | 1902 | GNUNET_NO); |
1915 | rid = ntohl (zis_msg->gns_header.r_id); | 1903 | rid = ntohl(zis_msg->gns_header.r_id); |
1916 | limit = GNUNET_ntohll (zis_msg->limit); | 1904 | limit = GNUNET_ntohll(zis_msg->limit); |
1917 | for (zi = nc->op_head; NULL != zi; zi = zi->next) | 1905 | for (zi = nc->op_head; NULL != zi; zi = zi->next) |
1918 | if (zi->request_id == rid) | 1906 | if (zi->request_id == rid) |
1919 | break; | 1907 | break; |
1920 | if (NULL == zi) | 1908 | if (NULL == zi) |
1921 | { | 1909 | { |
1922 | GNUNET_break (0); | 1910 | GNUNET_break(0); |
1923 | GNUNET_SERVICE_client_drop (nc->client); | 1911 | GNUNET_SERVICE_client_drop(nc->client); |
1924 | return; | 1912 | return; |
1925 | } | 1913 | } |
1926 | run_zone_iteration_round (zi, limit); | 1914 | run_zone_iteration_round(zi, limit); |
1927 | } | 1915 | } |
1928 | 1916 | ||
1929 | 1917 | ||
@@ -1933,37 +1921,37 @@ handle_iteration_next (void *cls, | |||
1933 | * monitor not being ready. | 1921 | * monitor not being ready. |
1934 | */ | 1922 | */ |
1935 | static void | 1923 | static void |
1936 | monitor_unblock (struct ZoneMonitor *zm) | 1924 | monitor_unblock(struct ZoneMonitor *zm) |
1937 | { | 1925 | { |
1938 | struct StoreActivity *sa = sa_head; | 1926 | struct StoreActivity *sa = sa_head; |
1939 | 1927 | ||
1940 | while ((NULL != sa) && (zm->limit > zm->iteration_cnt)) | 1928 | while ((NULL != sa) && (zm->limit > zm->iteration_cnt)) |
1941 | { | 1929 | { |
1942 | struct StoreActivity *sn = sa->next; | 1930 | struct StoreActivity *sn = sa->next; |
1943 | 1931 | ||
1944 | if (sa->zm_pos == zm) | 1932 | if (sa->zm_pos == zm) |
1945 | continue_store_activity (sa); | 1933 | continue_store_activity(sa); |
1946 | sa = sn; | 1934 | sa = sn; |
1947 | } | 1935 | } |
1948 | if (zm->limit > zm->iteration_cnt) | 1936 | if (zm->limit > zm->iteration_cnt) |
1949 | { | ||
1950 | zm->sa_waiting = GNUNET_NO; | ||
1951 | if (NULL != zm->sa_wait_warning) | ||
1952 | { | 1937 | { |
1953 | GNUNET_SCHEDULER_cancel (zm->sa_wait_warning); | 1938 | zm->sa_waiting = GNUNET_NO; |
1954 | zm->sa_wait_warning = NULL; | 1939 | if (NULL != zm->sa_wait_warning) |
1940 | { | ||
1941 | GNUNET_SCHEDULER_cancel(zm->sa_wait_warning); | ||
1942 | zm->sa_wait_warning = NULL; | ||
1943 | } | ||
1955 | } | 1944 | } |
1956 | } | ||
1957 | else if (GNUNET_YES == zm->sa_waiting) | 1945 | else if (GNUNET_YES == zm->sa_waiting) |
1958 | { | 1946 | { |
1959 | zm->sa_waiting_start = GNUNET_TIME_absolute_get (); | 1947 | zm->sa_waiting_start = GNUNET_TIME_absolute_get(); |
1960 | if (NULL != zm->sa_wait_warning) | 1948 | if (NULL != zm->sa_wait_warning) |
1961 | GNUNET_SCHEDULER_cancel (zm->sa_wait_warning); | 1949 | GNUNET_SCHEDULER_cancel(zm->sa_wait_warning); |
1962 | zm->sa_wait_warning = | 1950 | zm->sa_wait_warning = |
1963 | GNUNET_SCHEDULER_add_delayed (MONITOR_STALL_WARN_DELAY, | 1951 | GNUNET_SCHEDULER_add_delayed(MONITOR_STALL_WARN_DELAY, |
1964 | &warn_monitor_slow, | 1952 | &warn_monitor_slow, |
1965 | zm); | 1953 | zm); |
1966 | } | 1954 | } |
1967 | } | 1955 | } |
1968 | 1956 | ||
1969 | 1957 | ||
@@ -1973,18 +1961,18 @@ monitor_unblock (struct ZoneMonitor *zm) | |||
1973 | * @param zm monitor that is now in sync | 1961 | * @param zm monitor that is now in sync |
1974 | */ | 1962 | */ |
1975 | static void | 1963 | static void |
1976 | monitor_sync (struct ZoneMonitor *zm) | 1964 | monitor_sync(struct ZoneMonitor *zm) |
1977 | { | 1965 | { |
1978 | struct GNUNET_MQ_Envelope *env; | 1966 | struct GNUNET_MQ_Envelope *env; |
1979 | struct GNUNET_MessageHeader *sync; | 1967 | struct GNUNET_MessageHeader *sync; |
1980 | 1968 | ||
1981 | env = GNUNET_MQ_msg (sync, GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_SYNC); | 1969 | env = GNUNET_MQ_msg(sync, GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_SYNC); |
1982 | GNUNET_MQ_send (zm->nc->mq, env); | 1970 | GNUNET_MQ_send(zm->nc->mq, env); |
1983 | /* mark iteration done */ | 1971 | /* mark iteration done */ |
1984 | zm->in_first_iteration = GNUNET_NO; | 1972 | zm->in_first_iteration = GNUNET_NO; |
1985 | zm->iteration_cnt = 0; | 1973 | zm->iteration_cnt = 0; |
1986 | if ((zm->limit > 0) && (zm->sa_waiting)) | 1974 | if ((zm->limit > 0) && (zm->sa_waiting)) |
1987 | monitor_unblock (zm); | 1975 | monitor_unblock(zm); |
1988 | } | 1976 | } |
1989 | 1977 | ||
1990 | 1978 | ||
@@ -1994,7 +1982,7 @@ monitor_sync (struct ZoneMonitor *zm) | |||
1994 | * @param cls zone monitor that does its initial iteration | 1982 | * @param cls zone monitor that does its initial iteration |
1995 | */ | 1983 | */ |
1996 | static void | 1984 | static void |
1997 | monitor_iteration_next (void *cls); | 1985 | monitor_iteration_next(void *cls); |
1998 | 1986 | ||
1999 | 1987 | ||
2000 | /** | 1988 | /** |
@@ -2008,32 +1996,32 @@ monitor_iteration_next (void *cls); | |||
2008 | * @param rd array of records | 1996 | * @param rd array of records |
2009 | */ | 1997 | */ |
2010 | static void | 1998 | static void |
2011 | monitor_iterate_cb (void *cls, | 1999 | monitor_iterate_cb(void *cls, |
2012 | uint64_t seq, | 2000 | uint64_t seq, |
2013 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 2001 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
2014 | const char *name, | 2002 | const char *name, |
2015 | unsigned int rd_count, | 2003 | unsigned int rd_count, |
2016 | const struct GNUNET_GNSRECORD_Data *rd) | 2004 | const struct GNUNET_GNSRECORD_Data *rd) |
2017 | { | 2005 | { |
2018 | struct ZoneMonitor *zm = cls; | 2006 | struct ZoneMonitor *zm = cls; |
2019 | 2007 | ||
2020 | GNUNET_assert (0 != seq); | 2008 | GNUNET_assert(0 != seq); |
2021 | zm->seq = seq; | 2009 | zm->seq = seq; |
2022 | GNUNET_assert (NULL != name); | 2010 | GNUNET_assert(NULL != name); |
2023 | GNUNET_STATISTICS_update (statistics, | 2011 | GNUNET_STATISTICS_update(statistics, |
2024 | "Monitor notifications sent", | 2012 | "Monitor notifications sent", |
2025 | 1, | 2013 | 1, |
2026 | GNUNET_NO); | 2014 | GNUNET_NO); |
2027 | zm->limit--; | 2015 | zm->limit--; |
2028 | zm->iteration_cnt--; | 2016 | zm->iteration_cnt--; |
2029 | send_lookup_response (zm->nc, 0, zone_key, name, rd_count, rd); | 2017 | send_lookup_response(zm->nc, 0, zone_key, name, rd_count, rd); |
2030 | if ((0 == zm->iteration_cnt) && (0 != zm->limit)) | 2018 | if ((0 == zm->iteration_cnt) && (0 != zm->limit)) |
2031 | { | 2019 | { |
2032 | /* We are done with the current iteration batch, AND the | 2020 | /* We are done with the current iteration batch, AND the |
2033 | client would right now accept more, so go again! */ | 2021 | client would right now accept more, so go again! */ |
2034 | GNUNET_assert (NULL == zm->task); | 2022 | GNUNET_assert(NULL == zm->task); |
2035 | zm->task = GNUNET_SCHEDULER_add_now (&monitor_iteration_next, zm); | 2023 | zm->task = GNUNET_SCHEDULER_add_now(&monitor_iteration_next, zm); |
2036 | } | 2024 | } |
2037 | } | 2025 | } |
2038 | 2026 | ||
2039 | 2027 | ||
@@ -2044,25 +2032,25 @@ monitor_iterate_cb (void *cls, | |||
2044 | * @param zis_msg message from the client | 2032 | * @param zis_msg message from the client |
2045 | */ | 2033 | */ |
2046 | static void | 2034 | static void |
2047 | handle_monitor_start (void *cls, const struct ZoneMonitorStartMessage *zis_msg) | 2035 | handle_monitor_start(void *cls, const struct ZoneMonitorStartMessage *zis_msg) |
2048 | { | 2036 | { |
2049 | struct NamestoreClient *nc = cls; | 2037 | struct NamestoreClient *nc = cls; |
2050 | struct ZoneMonitor *zm; | 2038 | struct ZoneMonitor *zm; |
2051 | 2039 | ||
2052 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_MONITOR_START message\n"); | 2040 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_MONITOR_START message\n"); |
2053 | zm = GNUNET_new (struct ZoneMonitor); | 2041 | zm = GNUNET_new(struct ZoneMonitor); |
2054 | zm->nc = nc; | 2042 | zm->nc = nc; |
2055 | zm->zone = zis_msg->zone; | 2043 | zm->zone = zis_msg->zone; |
2056 | zm->limit = 1; | 2044 | zm->limit = 1; |
2057 | zm->in_first_iteration = (GNUNET_YES == ntohl (zis_msg->iterate_first)); | 2045 | zm->in_first_iteration = (GNUNET_YES == ntohl(zis_msg->iterate_first)); |
2058 | GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, zm); | 2046 | GNUNET_CONTAINER_DLL_insert(monitor_head, monitor_tail, zm); |
2059 | GNUNET_SERVICE_client_mark_monitor (nc->client); | 2047 | GNUNET_SERVICE_client_mark_monitor(nc->client); |
2060 | GNUNET_SERVICE_client_continue (nc->client); | 2048 | GNUNET_SERVICE_client_continue(nc->client); |
2061 | GNUNET_notification_context_add (monitor_nc, nc->mq); | 2049 | GNUNET_notification_context_add(monitor_nc, nc->mq); |
2062 | if (zm->in_first_iteration) | 2050 | if (zm->in_first_iteration) |
2063 | zm->task = GNUNET_SCHEDULER_add_now (&monitor_iteration_next, zm); | 2051 | zm->task = GNUNET_SCHEDULER_add_now(&monitor_iteration_next, zm); |
2064 | else | 2052 | else |
2065 | monitor_sync (zm); | 2053 | monitor_sync(zm); |
2066 | } | 2054 | } |
2067 | 2055 | ||
2068 | 2056 | ||
@@ -2072,36 +2060,36 @@ handle_monitor_start (void *cls, const struct ZoneMonitorStartMessage *zis_msg) | |||
2072 | * @param cls zone monitor that does its initial iteration | 2060 | * @param cls zone monitor that does its initial iteration |
2073 | */ | 2061 | */ |
2074 | static void | 2062 | static void |
2075 | monitor_iteration_next (void *cls) | 2063 | monitor_iteration_next(void *cls) |
2076 | { | 2064 | { |
2077 | struct ZoneMonitor *zm = cls; | 2065 | struct ZoneMonitor *zm = cls; |
2078 | int ret; | 2066 | int ret; |
2079 | 2067 | ||
2080 | zm->task = NULL; | 2068 | zm->task = NULL; |
2081 | GNUNET_assert (0 == zm->iteration_cnt); | 2069 | GNUNET_assert(0 == zm->iteration_cnt); |
2082 | if (zm->limit > 16) | 2070 | if (zm->limit > 16) |
2083 | zm->iteration_cnt = zm->limit / 2; /* leave half for monitor events */ | 2071 | zm->iteration_cnt = zm->limit / 2; /* leave half for monitor events */ |
2084 | else | 2072 | else |
2085 | zm->iteration_cnt = zm->limit; /* use it all */ | 2073 | zm->iteration_cnt = zm->limit; /* use it all */ |
2086 | ret = GSN_database->iterate_records (GSN_database->cls, | 2074 | ret = GSN_database->iterate_records(GSN_database->cls, |
2087 | (0 == GNUNET_is_zero (&zm->zone)) | 2075 | (0 == GNUNET_is_zero(&zm->zone)) |
2088 | ? NULL | 2076 | ? NULL |
2089 | : &zm->zone, | 2077 | : &zm->zone, |
2090 | zm->seq, | 2078 | zm->seq, |
2091 | zm->iteration_cnt, | 2079 | zm->iteration_cnt, |
2092 | &monitor_iterate_cb, | 2080 | &monitor_iterate_cb, |
2093 | zm); | 2081 | zm); |
2094 | if (GNUNET_SYSERR == ret) | 2082 | if (GNUNET_SYSERR == ret) |
2095 | { | 2083 | { |
2096 | GNUNET_SERVICE_client_drop (zm->nc->client); | 2084 | GNUNET_SERVICE_client_drop(zm->nc->client); |
2097 | return; | 2085 | return; |
2098 | } | 2086 | } |
2099 | if (GNUNET_NO == ret) | 2087 | if (GNUNET_NO == ret) |
2100 | { | 2088 | { |
2101 | /* empty zone */ | 2089 | /* empty zone */ |
2102 | monitor_sync (zm); | 2090 | monitor_sync(zm); |
2103 | return; | 2091 | return; |
2104 | } | 2092 | } |
2105 | } | 2093 | } |
2106 | 2094 | ||
2107 | 2095 | ||
@@ -2112,55 +2100,55 @@ monitor_iteration_next (void *cls) | |||
2112 | * @param nm message from the client | 2100 | * @param nm message from the client |
2113 | */ | 2101 | */ |
2114 | static void | 2102 | static void |
2115 | handle_monitor_next (void *cls, const struct ZoneMonitorNextMessage *nm) | 2103 | handle_monitor_next(void *cls, const struct ZoneMonitorNextMessage *nm) |
2116 | { | 2104 | { |
2117 | struct NamestoreClient *nc = cls; | 2105 | struct NamestoreClient *nc = cls; |
2118 | struct ZoneMonitor *zm; | 2106 | struct ZoneMonitor *zm; |
2119 | uint64_t inc; | 2107 | uint64_t inc; |
2120 | 2108 | ||
2121 | inc = GNUNET_ntohll (nm->limit); | 2109 | inc = GNUNET_ntohll(nm->limit); |
2122 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2110 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
2123 | "Received ZONE_MONITOR_NEXT message with limit %llu\n", | 2111 | "Received ZONE_MONITOR_NEXT message with limit %llu\n", |
2124 | (unsigned long long) inc); | 2112 | (unsigned long long)inc); |
2125 | for (zm = monitor_head; NULL != zm; zm = zm->next) | 2113 | for (zm = monitor_head; NULL != zm; zm = zm->next) |
2126 | if (zm->nc == nc) | 2114 | if (zm->nc == nc) |
2127 | break; | 2115 | break; |
2128 | if (NULL == zm) | 2116 | if (NULL == zm) |
2129 | { | 2117 | { |
2130 | GNUNET_break (0); | 2118 | GNUNET_break(0); |
2131 | GNUNET_SERVICE_client_drop (nc->client); | 2119 | GNUNET_SERVICE_client_drop(nc->client); |
2132 | return; | 2120 | return; |
2133 | } | 2121 | } |
2134 | GNUNET_SERVICE_client_continue (nc->client); | 2122 | GNUNET_SERVICE_client_continue(nc->client); |
2135 | if (zm->limit + inc < zm->limit) | 2123 | if (zm->limit + inc < zm->limit) |
2136 | { | 2124 | { |
2137 | GNUNET_break (0); | 2125 | GNUNET_break(0); |
2138 | GNUNET_SERVICE_client_drop (nc->client); | 2126 | GNUNET_SERVICE_client_drop(nc->client); |
2139 | return; | 2127 | return; |
2140 | } | 2128 | } |
2141 | zm->limit += inc; | 2129 | zm->limit += inc; |
2142 | if ((zm->in_first_iteration) && (zm->limit == inc)) | 2130 | if ((zm->in_first_iteration) && (zm->limit == inc)) |
2143 | { | 2131 | { |
2144 | /* We are still iterating, and the previous iteration must | 2132 | /* We are still iterating, and the previous iteration must |
2145 | have stopped due to the client's limit, so continue it! */ | 2133 | have stopped due to the client's limit, so continue it! */ |
2146 | GNUNET_assert (NULL == zm->task); | 2134 | GNUNET_assert(NULL == zm->task); |
2147 | zm->task = GNUNET_SCHEDULER_add_now (&monitor_iteration_next, zm); | 2135 | zm->task = GNUNET_SCHEDULER_add_now(&monitor_iteration_next, zm); |
2148 | } | 2136 | } |
2149 | GNUNET_assert (zm->iteration_cnt <= zm->limit); | 2137 | GNUNET_assert(zm->iteration_cnt <= zm->limit); |
2150 | if ((zm->limit > zm->iteration_cnt) && (zm->sa_waiting)) | 2138 | if ((zm->limit > zm->iteration_cnt) && (zm->sa_waiting)) |
2151 | { | 2139 | { |
2152 | monitor_unblock (zm); | 2140 | monitor_unblock(zm); |
2153 | } | 2141 | } |
2154 | else if (GNUNET_YES == zm->sa_waiting) | 2142 | else if (GNUNET_YES == zm->sa_waiting) |
2155 | { | 2143 | { |
2156 | if (NULL != zm->sa_wait_warning) | 2144 | if (NULL != zm->sa_wait_warning) |
2157 | GNUNET_SCHEDULER_cancel (zm->sa_wait_warning); | 2145 | GNUNET_SCHEDULER_cancel(zm->sa_wait_warning); |
2158 | zm->sa_waiting_start = GNUNET_TIME_absolute_get (); | 2146 | zm->sa_waiting_start = GNUNET_TIME_absolute_get(); |
2159 | zm->sa_wait_warning = | 2147 | zm->sa_wait_warning = |
2160 | GNUNET_SCHEDULER_add_delayed (MONITOR_STALL_WARN_DELAY, | 2148 | GNUNET_SCHEDULER_add_delayed(MONITOR_STALL_WARN_DELAY, |
2161 | &warn_monitor_slow, | 2149 | &warn_monitor_slow, |
2162 | zm); | 2150 | zm); |
2163 | } | 2151 | } |
2164 | } | 2152 | } |
2165 | 2153 | ||
2166 | 2154 | ||
@@ -2172,92 +2160,92 @@ handle_monitor_next (void *cls, const struct ZoneMonitorNextMessage *nm) | |||
2172 | * @param service the initialized service | 2160 | * @param service the initialized service |
2173 | */ | 2161 | */ |
2174 | static void | 2162 | static void |
2175 | run (void *cls, | 2163 | run(void *cls, |
2176 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 2164 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
2177 | struct GNUNET_SERVICE_Handle *service) | 2165 | struct GNUNET_SERVICE_Handle *service) |
2178 | { | 2166 | { |
2179 | char *database; | 2167 | char *database; |
2180 | 2168 | ||
2181 | (void) cls; | 2169 | (void)cls; |
2182 | (void) service; | 2170 | (void)service; |
2183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n"); | 2171 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n"); |
2184 | cache_keys = | 2172 | cache_keys = |
2185 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "namestore", "CACHE_KEYS"); | 2173 | GNUNET_CONFIGURATION_get_value_yesno(cfg, "namestore", "CACHE_KEYS"); |
2186 | disable_namecache = | 2174 | disable_namecache = |
2187 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "namecache", "DISABLE"); | 2175 | GNUNET_CONFIGURATION_get_value_yesno(cfg, "namecache", "DISABLE"); |
2188 | GSN_cfg = cfg; | 2176 | GSN_cfg = cfg; |
2189 | monitor_nc = GNUNET_notification_context_create (1); | 2177 | monitor_nc = GNUNET_notification_context_create(1); |
2190 | if (GNUNET_YES != disable_namecache) | 2178 | if (GNUNET_YES != disable_namecache) |
2191 | { | 2179 | { |
2192 | namecache = GNUNET_NAMECACHE_connect (cfg); | 2180 | namecache = GNUNET_NAMECACHE_connect(cfg); |
2193 | GNUNET_assert (NULL != namecache); | 2181 | GNUNET_assert(NULL != namecache); |
2194 | } | 2182 | } |
2195 | /* Loading database plugin */ | 2183 | /* Loading database plugin */ |
2196 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, | 2184 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(cfg, |
2197 | "namestore", | 2185 | "namestore", |
2198 | "database", | 2186 | "database", |
2199 | &database)) | 2187 | &database)) |
2200 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n"); | 2188 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n"); |
2201 | 2189 | ||
2202 | GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_namestore_%s", database); | 2190 | GNUNET_asprintf(&db_lib_name, "libgnunet_plugin_namestore_%s", database); |
2203 | GSN_database = GNUNET_PLUGIN_load (db_lib_name, (void *) GSN_cfg); | 2191 | GSN_database = GNUNET_PLUGIN_load(db_lib_name, (void *)GSN_cfg); |
2204 | GNUNET_free (database); | 2192 | GNUNET_free(database); |
2205 | statistics = GNUNET_STATISTICS_create ("namestore", cfg); | 2193 | statistics = GNUNET_STATISTICS_create("namestore", cfg); |
2206 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL); | 2194 | GNUNET_SCHEDULER_add_shutdown(&cleanup_task, NULL); |
2207 | if (NULL == GSN_database) | 2195 | if (NULL == GSN_database) |
2208 | { | 2196 | { |
2209 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2197 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
2210 | "Could not load database backend `%s'\n", | 2198 | "Could not load database backend `%s'\n", |
2211 | db_lib_name); | 2199 | db_lib_name); |
2212 | GNUNET_SCHEDULER_shutdown (); | 2200 | GNUNET_SCHEDULER_shutdown(); |
2213 | return; | 2201 | return; |
2214 | } | 2202 | } |
2215 | } | 2203 | } |
2216 | 2204 | ||
2217 | 2205 | ||
2218 | /** | 2206 | /** |
2219 | * Define "main" method using service macro. | 2207 | * Define "main" method using service macro. |
2220 | */ | 2208 | */ |
2221 | GNUNET_SERVICE_MAIN ( | 2209 | GNUNET_SERVICE_MAIN( |
2222 | "namestore", | 2210 | "namestore", |
2223 | GNUNET_SERVICE_OPTION_NONE, | 2211 | GNUNET_SERVICE_OPTION_NONE, |
2224 | &run, | 2212 | &run, |
2225 | &client_connect_cb, | 2213 | &client_connect_cb, |
2226 | &client_disconnect_cb, | 2214 | &client_disconnect_cb, |
2227 | NULL, | 2215 | NULL, |
2228 | GNUNET_MQ_hd_var_size (record_store, | 2216 | GNUNET_MQ_hd_var_size(record_store, |
2229 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE, | 2217 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE, |
2230 | struct RecordStoreMessage, | 2218 | struct RecordStoreMessage, |
2231 | NULL), | 2219 | NULL), |
2232 | GNUNET_MQ_hd_var_size (record_lookup, | 2220 | GNUNET_MQ_hd_var_size(record_lookup, |
2233 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP, | 2221 | GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP, |
2234 | struct LabelLookupMessage, | 2222 | struct LabelLookupMessage, |
2235 | NULL), | 2223 | NULL), |
2236 | GNUNET_MQ_hd_fixed_size (zone_to_name, | 2224 | GNUNET_MQ_hd_fixed_size(zone_to_name, |
2237 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, | 2225 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, |
2238 | struct ZoneToNameMessage, | 2226 | struct ZoneToNameMessage, |
2239 | NULL), | 2227 | NULL), |
2240 | GNUNET_MQ_hd_fixed_size (iteration_start, | 2228 | GNUNET_MQ_hd_fixed_size(iteration_start, |
2241 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, | 2229 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, |
2242 | struct ZoneIterationStartMessage, | 2230 | struct ZoneIterationStartMessage, |
2243 | NULL), | 2231 | NULL), |
2244 | GNUNET_MQ_hd_fixed_size (iteration_next, | 2232 | GNUNET_MQ_hd_fixed_size(iteration_next, |
2245 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, | 2233 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, |
2246 | struct ZoneIterationNextMessage, | 2234 | struct ZoneIterationNextMessage, |
2247 | NULL), | 2235 | NULL), |
2248 | GNUNET_MQ_hd_fixed_size (iteration_stop, | 2236 | GNUNET_MQ_hd_fixed_size(iteration_stop, |
2249 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, | 2237 | GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, |
2250 | struct ZoneIterationStopMessage, | 2238 | struct ZoneIterationStopMessage, |
2251 | NULL), | 2239 | NULL), |
2252 | GNUNET_MQ_hd_fixed_size (monitor_start, | 2240 | GNUNET_MQ_hd_fixed_size(monitor_start, |
2253 | GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START, | 2241 | GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START, |
2254 | struct ZoneMonitorStartMessage, | 2242 | struct ZoneMonitorStartMessage, |
2255 | NULL), | 2243 | NULL), |
2256 | GNUNET_MQ_hd_fixed_size (monitor_next, | 2244 | GNUNET_MQ_hd_fixed_size(monitor_next, |
2257 | GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT, | 2245 | GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT, |
2258 | struct ZoneMonitorNextMessage, | 2246 | struct ZoneMonitorNextMessage, |
2259 | NULL), | 2247 | NULL), |
2260 | GNUNET_MQ_handler_end ()); | 2248 | GNUNET_MQ_handler_end()); |
2261 | 2249 | ||
2262 | 2250 | ||
2263 | /* end of gnunet-service-namestore.c */ | 2251 | /* end of gnunet-service-namestore.c */ |