diff options
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 6b56784db..a0e275f2d 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -616,6 +616,15 @@ struct MigrationReadyBlock | |||
616 | */ | 616 | */ |
617 | static struct GNUNET_DATASTORE_Handle *dsh; | 617 | static struct GNUNET_DATASTORE_Handle *dsh; |
618 | 618 | ||
619 | /** | ||
620 | * Our block context. | ||
621 | */ | ||
622 | static struct GNUNET_BLOCK_Context *block_ctx; | ||
623 | |||
624 | /** | ||
625 | * Our block configuration. | ||
626 | */ | ||
627 | static struct GNUNET_CONFIGURATION_Handle *block_cfg; | ||
619 | 628 | ||
620 | /** | 629 | /** |
621 | * Our scheduler. | 630 | * Our scheduler. |
@@ -1569,12 +1578,19 @@ shutdown_task (void *cls, | |||
1569 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | 1578 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
1570 | stats = NULL; | 1579 | stats = NULL; |
1571 | } | 1580 | } |
1572 | GNUNET_DATASTORE_disconnect (dsh, | 1581 | if (dsh != NULL) |
1573 | GNUNET_NO); | 1582 | { |
1583 | GNUNET_DATASTORE_disconnect (dsh, | ||
1584 | GNUNET_NO); | ||
1585 | dsh = NULL; | ||
1586 | } | ||
1574 | while (mig_head != NULL) | 1587 | while (mig_head != NULL) |
1575 | delete_migration_block (mig_head); | 1588 | delete_migration_block (mig_head); |
1576 | GNUNET_assert (0 == mig_size); | 1589 | GNUNET_assert (0 == mig_size); |
1577 | dsh = NULL; | 1590 | GNUNET_BLOCK_context_destroy (block_ctx); |
1591 | block_ctx = NULL; | ||
1592 | GNUNET_CONFIGURATION_destroy (block_cfg); | ||
1593 | block_cfg = NULL; | ||
1578 | sched = NULL; | 1594 | sched = NULL; |
1579 | cfg = NULL; | 1595 | cfg = NULL; |
1580 | GNUNET_free_non_null (trustDirectory); | 1596 | GNUNET_free_non_null (trustDirectory); |
@@ -2783,17 +2799,18 @@ handle_p2p_put (void *cls, | |||
2783 | type = ntohl (put->type); | 2799 | type = ntohl (put->type); |
2784 | expiration = GNUNET_TIME_absolute_ntoh (put->expiration); | 2800 | expiration = GNUNET_TIME_absolute_ntoh (put->expiration); |
2785 | 2801 | ||
2802 | if (type == GNUNET_BLOCK_TYPE_ONDEMAND) | ||
2803 | return GNUNET_SYSERR; | ||
2786 | if (GNUNET_OK != | 2804 | if (GNUNET_OK != |
2787 | GNUNET_BLOCK_check_block (type, | 2805 | GNUNET_BLOCK_get_key (block_ctx, |
2788 | &put[1], | 2806 | type, |
2789 | dsize, | 2807 | &put[1], |
2790 | &query)) | 2808 | dsize, |
2809 | &query)) | ||
2791 | { | 2810 | { |
2792 | GNUNET_break_op (0); | 2811 | GNUNET_break_op (0); |
2793 | return GNUNET_SYSERR; | 2812 | return GNUNET_SYSERR; |
2794 | } | 2813 | } |
2795 | if (type == GNUNET_BLOCK_TYPE_ONDEMAND) | ||
2796 | return GNUNET_SYSERR; | ||
2797 | if (GNUNET_BLOCK_TYPE_SBLOCK == type) | 2814 | if (GNUNET_BLOCK_TYPE_SBLOCK == type) |
2798 | { | 2815 | { |
2799 | sb = (const struct SBlock*) &put[1]; | 2816 | sb = (const struct SBlock*) &put[1]; |
@@ -3051,10 +3068,12 @@ process_local_reply (void *cls, | |||
3051 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 3068 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
3052 | &prq.namespace); | 3069 | &prq.namespace); |
3053 | } | 3070 | } |
3054 | if (GNUNET_OK != GNUNET_BLOCK_check_block (type, | 3071 | if (GNUNET_OK != |
3055 | data, | 3072 | GNUNET_BLOCK_get_key (block_ctx, |
3056 | size, | 3073 | type, |
3057 | &query)) | 3074 | data, |
3075 | size, | ||
3076 | &query)) | ||
3058 | { | 3077 | { |
3059 | GNUNET_break (0); | 3078 | GNUNET_break (0); |
3060 | GNUNET_DATASTORE_remove (dsh, | 3079 | GNUNET_DATASTORE_remove (dsh, |
@@ -3786,12 +3805,23 @@ run (void *cls, | |||
3786 | GNUNET_SCHEDULER_shutdown (sched); | 3805 | GNUNET_SCHEDULER_shutdown (sched); |
3787 | return; | 3806 | return; |
3788 | } | 3807 | } |
3808 | block_cfg = GNUNET_CONFIGURATION_create (); | ||
3809 | GNUNET_CONFIGURATION_set_value_string (block_cfg, | ||
3810 | "block", | ||
3811 | "PLUGINS", | ||
3812 | "fs"); | ||
3813 | block_ctx = GNUNET_BLOCK_context_create (block_cfg); | ||
3814 | GNUNET_assert (NULL != block_ctx); | ||
3789 | if ( (GNUNET_OK != GNUNET_FS_indexing_init (sched, cfg, dsh)) || | 3815 | if ( (GNUNET_OK != GNUNET_FS_indexing_init (sched, cfg, dsh)) || |
3790 | (GNUNET_OK != main_init (sched, server, cfg)) ) | 3816 | (GNUNET_OK != main_init (sched, server, cfg)) ) |
3791 | { | 3817 | { |
3792 | GNUNET_SCHEDULER_shutdown (sched); | 3818 | GNUNET_SCHEDULER_shutdown (sched); |
3793 | GNUNET_DATASTORE_disconnect (dsh, GNUNET_NO); | 3819 | GNUNET_DATASTORE_disconnect (dsh, GNUNET_NO); |
3794 | dsh = NULL; | 3820 | dsh = NULL; |
3821 | GNUNET_BLOCK_context_destroy (block_ctx); | ||
3822 | block_ctx = NULL; | ||
3823 | GNUNET_CONFIGURATION_destroy (block_cfg); | ||
3824 | block_cfg = NULL; | ||
3795 | return; | 3825 | return; |
3796 | } | 3826 | } |
3797 | } | 3827 | } |