diff options
Diffstat (limited to 'src/peerinfo/gnunet-service-peerinfo.c')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 11e311c22..f5a60470e 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -342,6 +342,8 @@ cron_scan_directory_data_hosts (void *cls, | |||
342 | static unsigned int retries; | 342 | static unsigned int retries; |
343 | unsigned int count; | 343 | unsigned int count; |
344 | 344 | ||
345 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | ||
346 | return; | ||
345 | count = 0; | 347 | count = 0; |
346 | GNUNET_DISK_directory_create (networkIdDirectory); | 348 | GNUNET_DISK_directory_create (networkIdDirectory); |
347 | GNUNET_DISK_directory_scan (networkIdDirectory, | 349 | GNUNET_DISK_directory_scan (networkIdDirectory, |
@@ -351,9 +353,6 @@ cron_scan_directory_data_hosts (void *cls, | |||
351 | GNUNET_ERROR_TYPE_BULK, | 353 | GNUNET_ERROR_TYPE_BULK, |
352 | _("Still no peers found in `%s'!\n"), networkIdDirectory); | 354 | _("Still no peers found in `%s'!\n"), networkIdDirectory); |
353 | GNUNET_SCHEDULER_add_delayed (tc->sched, | 355 | GNUNET_SCHEDULER_add_delayed (tc->sched, |
354 | GNUNET_NO, | ||
355 | GNUNET_SCHEDULER_PRIORITY_KEEP, | ||
356 | GNUNET_SCHEDULER_NO_TASK, | ||
357 | DATA_HOST_FREQ, | 356 | DATA_HOST_FREQ, |
358 | &cron_scan_directory_data_hosts, NULL); | 357 | &cron_scan_directory_data_hosts, NULL); |
359 | } | 358 | } |
@@ -501,12 +500,10 @@ cron_flush_trust (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
501 | flush_trust (pos); | 500 | flush_trust (pos); |
502 | pos = pos->next; | 501 | pos = pos->next; |
503 | } | 502 | } |
504 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 503 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
505 | GNUNET_SCHEDULER_add_delayed (tc->sched, | 504 | return; |
506 | GNUNET_YES, | 505 | GNUNET_SCHEDULER_add_delayed (tc->sched, |
507 | GNUNET_SCHEDULER_PRIORITY_KEEP, | 506 | TRUST_FLUSH_FREQ, &cron_flush_trust, NULL); |
508 | GNUNET_SCHEDULER_NO_TASK, | ||
509 | TRUST_FLUSH_FREQ, &cron_flush_trust, NULL); | ||
510 | } | 507 | } |
511 | 508 | ||
512 | 509 | ||
@@ -558,14 +555,13 @@ cron_clean_data_hosts (void *cls, | |||
558 | { | 555 | { |
559 | struct GNUNET_TIME_Absolute now; | 556 | struct GNUNET_TIME_Absolute now; |
560 | 557 | ||
558 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | ||
559 | return; | ||
561 | now = GNUNET_TIME_absolute_get (); | 560 | now = GNUNET_TIME_absolute_get (); |
562 | GNUNET_DISK_directory_scan (networkIdDirectory, | 561 | GNUNET_DISK_directory_scan (networkIdDirectory, |
563 | &discard_hosts_helper, &now); | 562 | &discard_hosts_helper, &now); |
564 | 563 | ||
565 | GNUNET_SCHEDULER_add_delayed (tc->sched, | 564 | GNUNET_SCHEDULER_add_delayed (tc->sched, |
566 | GNUNET_NO, | ||
567 | GNUNET_SCHEDULER_PRIORITY_KEEP, | ||
568 | GNUNET_SCHEDULER_NO_TASK, | ||
569 | DATA_HOST_CLEAN_FREQ, | 565 | DATA_HOST_CLEAN_FREQ, |
570 | &cron_clean_data_hosts, NULL); | 566 | &cron_clean_data_hosts, NULL); |
571 | } | 567 | } |
@@ -660,6 +656,7 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = { | |||
660 | }; | 656 | }; |
661 | 657 | ||
662 | 658 | ||
659 | |||
663 | /** | 660 | /** |
664 | * Process statistics requests. | 661 | * Process statistics requests. |
665 | * | 662 | * |
@@ -686,23 +683,15 @@ run (void *cls, | |||
686 | &trustDirectory)); | 683 | &trustDirectory)); |
687 | GNUNET_DISK_directory_create (networkIdDirectory); | 684 | GNUNET_DISK_directory_create (networkIdDirectory); |
688 | GNUNET_DISK_directory_create (trustDirectory); | 685 | GNUNET_DISK_directory_create (trustDirectory); |
689 | GNUNET_SCHEDULER_add_delayed (sched, | 686 | GNUNET_SCHEDULER_add_with_priority (sched, |
690 | GNUNET_NO, | 687 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
691 | GNUNET_SCHEDULER_PRIORITY_IDLE, | 688 | &cron_scan_directory_data_hosts, NULL); |
692 | GNUNET_SCHEDULER_NO_TASK, | 689 | GNUNET_SCHEDULER_add_with_priority (sched, |
693 | GNUNET_TIME_UNIT_MILLISECONDS, | 690 | GNUNET_SCHEDULER_PRIORITY_HIGH, |
694 | &cron_scan_directory_data_hosts, NULL); | 691 | &cron_flush_trust, NULL); |
695 | GNUNET_SCHEDULER_add_delayed (sched, | 692 | GNUNET_SCHEDULER_add_with_priority (sched, |
696 | GNUNET_YES, | 693 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
697 | GNUNET_SCHEDULER_PRIORITY_HIGH, | 694 | &cron_clean_data_hosts, NULL); |
698 | GNUNET_SCHEDULER_NO_TASK, | ||
699 | TRUST_FLUSH_FREQ, &cron_flush_trust, NULL); | ||
700 | GNUNET_SCHEDULER_add_delayed (sched, | ||
701 | GNUNET_NO, | ||
702 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
703 | GNUNET_SCHEDULER_NO_TASK, | ||
704 | DATA_HOST_CLEAN_FREQ, | ||
705 | &cron_clean_data_hosts, NULL); | ||
706 | GNUNET_SERVER_add_handlers (server, handlers); | 695 | GNUNET_SERVER_add_handlers (server, handlers); |
707 | } | 696 | } |
708 | 697 | ||
@@ -722,7 +711,7 @@ main (int argc, char *const *argv) | |||
722 | ret = (GNUNET_OK == | 711 | ret = (GNUNET_OK == |
723 | GNUNET_SERVICE_run (argc, | 712 | GNUNET_SERVICE_run (argc, |
724 | argv, | 713 | argv, |
725 | "peerinfo", &run, NULL, NULL, NULL)) ? 0 : 1; | 714 | "peerinfo", &run, NULL)) ? 0 : 1; |
726 | GNUNET_free_non_null (networkIdDirectory); | 715 | GNUNET_free_non_null (networkIdDirectory); |
727 | GNUNET_free_non_null (trustDirectory); | 716 | GNUNET_free_non_null (trustDirectory); |
728 | return ret; | 717 | return ret; |