aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_push.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-19 21:01:44 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-19 21:01:44 +0000
commitff74c423c7528e4920a7591e0e64b0b282a81bec (patch)
treea5124fdd98ceb0cf2df4e19de256575daad5b197 /src/fs/gnunet-service-fs_push.c
parent3121108ec2fd4f5c7a481955c8a02dc8ad65b40e (diff)
downloadgnunet-ff74c423c7528e4920a7591e0e64b0b282a81bec.tar.gz
gnunet-ff74c423c7528e4920a7591e0e64b0b282a81bec.zip
stuff
Diffstat (limited to 'src/fs/gnunet-service-fs_push.c')
-rw-r--r--src/fs/gnunet-service-fs_push.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index 90e888b6a..e4ba2d763 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -31,6 +31,8 @@
31#include "gnunet-service-fs_push.h" 31#include "gnunet-service-fs_push.h"
32 32
33 33
34#define DEBUG_FS_MIGRATION GNUNET_NO
35
34/** 36/**
35 * How long must content remain valid for us to consider it for migration? 37 * How long must content remain valid for us to consider it for migration?
36 * If content will expire too soon, there is clearly no point in pushing 38 * If content will expire too soon, there is clearly no point in pushing
@@ -219,7 +221,7 @@ transmit_message (void *cls,
219 peer->msg = NULL; 221 peer->msg = NULL;
220 if (buf == NULL) 222 if (buf == NULL)
221 { 223 {
222#if DEBUG_FS 224#if DEBUG_FS_MIGRATION
223 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
224 "Failed to migrate content to another peer (disconnect)\n"); 226 "Failed to migrate content to another peer (disconnect)\n");
225#endif 227#endif
@@ -230,7 +232,7 @@ transmit_message (void *cls,
230 GNUNET_assert (msize <= buf_size); 232 GNUNET_assert (msize <= buf_size);
231 memcpy (buf, msg, msize); 233 memcpy (buf, msg, msize);
232 GNUNET_free (msg); 234 GNUNET_free (msg);
233#if DEBUG_FS 235#if DEBUG_FS_MIGRATION
234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 236 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
235 "Pushing %u bytes to another peer\n", 237 "Pushing %u bytes to another peer\n",
236 msize); 238 msize);
@@ -287,7 +289,7 @@ transmit_content (struct MigrationReadyPeer *peer,
287 { 289 {
288 ret = GNUNET_NO; 290 ret = GNUNET_NO;
289 } 291 }
290#if DEBUG_FS 292#if DEBUG_FS_MIGRATION
291 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 293 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
292 "Asking for transmission of %u bytes for migration\n", 294 "Asking for transmission of %u bytes for migration\n",
293 msize); 295 msize);
@@ -391,13 +393,13 @@ find_content (struct MigrationReadyPeer *mrp)
391 { 393 {
392 if (mig_size < MAX_MIGRATION_QUEUE) 394 if (mig_size < MAX_MIGRATION_QUEUE)
393 { 395 {
394#if DEBUG_FS 396#if DEBUG_FS_MIGRATION
395 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 397 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
396 "No content found for pushing, waiting for queue to fill\n"); 398 "No content found for pushing, waiting for queue to fill\n");
397#endif 399#endif
398 return; /* will fill up eventually... */ 400 return; /* will fill up eventually... */
399 } 401 }
400#if DEBUG_FS 402#if DEBUG_FS_MIGRATION
401 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 403 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
402 "No suitable content found, purging content from full queue\n"); 404 "No suitable content found, purging content from full queue\n");
403#endif 405#endif
@@ -420,7 +422,7 @@ find_content (struct MigrationReadyPeer *mrp)
420 consider_gathering (); 422 consider_gathering ();
421 return; 423 return;
422 } 424 }
423#if DEBUG_FS 425#if DEBUG_FS_MIGRATION
424 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
425 "Preparing to push best content to peer\n"); 427 "Preparing to push best content to peer\n");
426#endif 428#endif
@@ -463,6 +465,11 @@ consider_gathering ()
463 MAX_MIGRATION_QUEUE); 465 MAX_MIGRATION_QUEUE);
464 delay = GNUNET_TIME_relative_max (delay, 466 delay = GNUNET_TIME_relative_max (delay,
465 min_migration_delay); 467 min_migration_delay);
468#if DEBUG_FS_MIGRATION
469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
470 "Scheduling gathering task (queue size: %u)\n",
471 mig_size);
472#endif
466 mig_task = GNUNET_SCHEDULER_add_delayed (delay, 473 mig_task = GNUNET_SCHEDULER_add_delayed (delay,
467 &gather_migration_blocks, 474 &gather_migration_blocks,
468 NULL); 475 NULL);
@@ -500,6 +507,10 @@ process_migration_content (void *cls,
500 mig_qe = NULL; 507 mig_qe = NULL;
501 if (key == NULL) 508 if (key == NULL)
502 { 509 {
510#if DEBUG_FS_MIGRATION
511 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
512 "No content found for migration...\n");
513#endif
503 consider_gathering (); 514 consider_gathering ();
504 return; 515 return;
505 } 516 }
@@ -521,13 +532,13 @@ process_migration_content (void *cls,
521 consider_gathering (); 532 consider_gathering ();
522 return; 533 return;
523 } 534 }
524#if DEBUG_FS 535#if DEBUG_FS_MIGRATION
525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
526 "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n", 537 "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n",
527 GNUNET_h2s (key), 538 GNUNET_h2s (key),
528 type, 539 type,
529 mig_size + 1, 540 mig_size + 1,
530 MIGRATION_LIST_SIZE); 541 MAX_MIGRATION_QUEUE);
531#endif 542#endif
532 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size); 543 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size);
533 mb->query = *key; 544 mb->query = *key;
@@ -545,7 +556,7 @@ process_migration_content (void *cls,
545 { 556 {
546 if (NULL == pos->th) 557 if (NULL == pos->th)
547 { 558 {
548#if DEBUG_FS 559#if DEBUG_FS_MIGRATION
549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 560 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
550 "Preparing to push best content to peer\n"); 561 "Preparing to push best content to peer\n");
551#endif 562#endif
@@ -574,6 +585,11 @@ gather_migration_blocks (void *cls,
574 return; 585 return;
575 if (GSF_dsh != NULL) 586 if (GSF_dsh != NULL)
576 { 587 {
588#if DEBUG_FS_MIGRATION
589 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
590 "Asking datastore for content for replication (queue size: %u)\n",
591 mig_size);
592#endif
577 mig_qe = GNUNET_DATASTORE_get_for_replication (GSF_dsh, 593 mig_qe = GNUNET_DATASTORE_get_for_replication (GSF_dsh,
578 0, UINT_MAX, 594 0, UINT_MAX,
579 GNUNET_TIME_UNIT_FOREVER_REL, 595 GNUNET_TIME_UNIT_FOREVER_REL,