aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-17 14:14:33 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-17 14:14:33 +0000
commit480dc321e78214299ed9eb6718e833752a90082c (patch)
treeffbca4fd7dc5684af4409e5e1c406db7c52ff39c /src
parent71be1744ba1e2396d97af436d45b397ad9ba333b (diff)
downloadgnunet-480dc321e78214299ed9eb6718e833752a90082c.tar.gz
gnunet-480dc321e78214299ed9eb6718e833752a90082c.zip
adding lifetime limits on migration content
Diffstat (limited to 'src')
-rw-r--r--src/fs/fs_test_lib.c6
-rw-r--r--src/fs/gnunet-service-fs.c16
2 files changed, 20 insertions, 2 deletions
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index f24a11e82..e63c5d596 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -33,6 +33,8 @@
33 33
34#define CONNECT_ATTEMPTS 4 34#define CONNECT_ATTEMPTS 4
35 35
36#define CONTENT_LIFETIME GNUNET_TIME_UNIT_HOURS
37
36/** 38/**
37 * Handle for a daemon started for testing FS. 39 * Handle for a daemon started for testing FS.
38 */ 40 */
@@ -673,7 +675,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon,
673 do_index, 675 do_index,
674 anonymity, 676 anonymity,
675 42 /* priority */, 677 42 /* priority */,
676 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS)); 678 GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME));
677 } 679 }
678 else 680 else
679 { 681 {
@@ -687,7 +689,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon,
687 do_index, 689 do_index,
688 anonymity, 690 anonymity,
689 42 /* priority */, 691 42 /* priority */,
690 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS)); 692 GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME));
691 } 693 }
692 daemon->publish_context = GNUNET_FS_publish_start (daemon->fs, 694 daemon->publish_context = GNUNET_FS_publish_start (daemon->fs,
693 fi, 695 fi,
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index c8271ed8e..deaa04289 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -92,6 +92,15 @@
92#define MAX_DHT_PUT_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 92#define MAX_DHT_PUT_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
93 93
94/** 94/**
95 * How long must content remain valid for us to consider it for migration?
96 * If content will expire too soon, there is clearly no point in pushing
97 * it to other peers. This value gives the threshold for migration. Note
98 * that if this value is increased, the migration testcase may need to be
99 * adjusted as well (especially the CONTENT_LIFETIME in fs_test_lib.c).
100 */
101#define MIN_MIGRATION_CONTENT_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
102
103/**
95 * Inverse of the probability that we will submit the same query 104 * Inverse of the probability that we will submit the same query
96 * to the same peer again. If the same peer already got the query 105 * to the same peer again. If the same peer already got the query
97 * repeatedly recently, the probability is multiplied by the inverse 106 * repeatedly recently, the probability is multiplied by the inverse
@@ -1283,6 +1292,13 @@ process_migration_content (void *cls,
1283 consider_migration_gathering (); 1292 consider_migration_gathering ();
1284 return; 1293 return;
1285 } 1294 }
1295 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value <
1296 MIN_MIGRATION_CONTENT_LIFETIME.rel_value)
1297 {
1298 /* content will expire soon, don't bother */
1299 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
1300 return;
1301 }
1286 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) 1302 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
1287 { 1303 {
1288 if (GNUNET_OK != 1304 if (GNUNET_OK !=