diff options
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 3886e1de3..7074fc6a5 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -885,7 +885,12 @@ static unsigned int mig_size; | |||
885 | /** | 885 | /** |
886 | * Are we allowed to migrate content to this peer. | 886 | * Are we allowed to migrate content to this peer. |
887 | */ | 887 | */ |
888 | static int active_migration; | 888 | static int active_to_migration; |
889 | |||
890 | /** | ||
891 | * Are we allowed to push out content from this peer. | ||
892 | */ | ||
893 | static int active_from_migration; | ||
889 | 894 | ||
890 | /** | 895 | /** |
891 | * How many entires with zero anonymity do we currently estimate | 896 | * How many entires with zero anonymity do we currently estimate |
@@ -3618,7 +3623,7 @@ handle_p2p_put (void *cls, | |||
3618 | prq.sender->inc_preference += CONTENT_BANDWIDTH_VALUE + 1000 * prq.priority; | 3623 | prq.sender->inc_preference += CONTENT_BANDWIDTH_VALUE + 1000 * prq.priority; |
3619 | change_host_trust (prq.sender, prq.priority); | 3624 | change_host_trust (prq.sender, prq.priority); |
3620 | } | 3625 | } |
3621 | if ( (GNUNET_YES == active_migration) && | 3626 | if ( (GNUNET_YES == active_to_migration) && |
3622 | (GNUNET_NO == test_put_load_too_high (prq.priority)) ) | 3627 | (GNUNET_NO == test_put_load_too_high (prq.priority)) ) |
3623 | { | 3628 | { |
3624 | #if DEBUG_FS | 3629 | #if DEBUG_FS |
@@ -3640,7 +3645,7 @@ handle_p2p_put (void *cls, | |||
3640 | } | 3645 | } |
3641 | putl = GNUNET_LOAD_get_load (datastore_put_load); | 3646 | putl = GNUNET_LOAD_get_load (datastore_put_load); |
3642 | if ( (GNUNET_NO == prq.request_found) && | 3647 | if ( (GNUNET_NO == prq.request_found) && |
3643 | ( (GNUNET_YES != active_migration) || | 3648 | ( (GNUNET_YES != active_to_migration) || |
3644 | (putl > 2.5 * (1 + prq.priority)) ) ) | 3649 | (putl > 2.5 * (1 + prq.priority)) ) ) |
3645 | { | 3650 | { |
3646 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 3651 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
@@ -3648,7 +3653,7 @@ handle_p2p_put (void *cls, | |||
3648 | if (GNUNET_TIME_absolute_get_duration (cp->last_migration_block).rel_value < 5000) | 3653 | if (GNUNET_TIME_absolute_get_duration (cp->last_migration_block).rel_value < 5000) |
3649 | return GNUNET_OK; /* already blocked */ | 3654 | return GNUNET_OK; /* already blocked */ |
3650 | /* We're too busy; send MigrationStop message! */ | 3655 | /* We're too busy; send MigrationStop message! */ |
3651 | if (GNUNET_YES != active_migration) | 3656 | if (GNUNET_YES != active_to_migration) |
3652 | putl = 1.0 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 5); | 3657 | putl = 1.0 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 5); |
3653 | block_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | 3658 | block_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, |
3654 | 5000 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 3659 | 5000 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
@@ -4587,8 +4592,7 @@ main_init (struct GNUNET_SERVER_Handle *server, | |||
4587 | } | 4592 | } |
4588 | return GNUNET_SYSERR; | 4593 | return GNUNET_SYSERR; |
4589 | } | 4594 | } |
4590 | /* FIXME: distinguish between sending and storing in options? */ | 4595 | if (active_from_migration) |
4591 | if (active_migration) | ||
4592 | { | 4596 | { |
4593 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 4597 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
4594 | _("Content migration is enabled, will start to gather data\n")); | 4598 | _("Content migration is enabled, will start to gather data\n")); |
@@ -4628,9 +4632,12 @@ run (void *cls, | |||
4628 | struct GNUNET_SERVER_Handle *server, | 4632 | struct GNUNET_SERVER_Handle *server, |
4629 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 4633 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
4630 | { | 4634 | { |
4631 | active_migration = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 4635 | active_to_migration = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
4632 | "FS", | 4636 | "FS", |
4633 | "ACTIVEMIGRATION"); | 4637 | "CONTENT_CACHING"); |
4638 | active_from_migration = GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
4639 | "FS", | ||
4640 | "CONTENT_PUSHING"); | ||
4634 | dsh = GNUNET_DATASTORE_connect (cfg); | 4641 | dsh = GNUNET_DATASTORE_connect (cfg); |
4635 | if (dsh == NULL) | 4642 | if (dsh == NULL) |
4636 | { | 4643 | { |