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