aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_push.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-26 14:02:09 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-26 14:02:09 +0000
commita9763a49d78b240fed1ace9068a0ea11cdff00f7 (patch)
tree292f58cc3a0765c58952cd83c695e1faafc83fd9 /src/fs/gnunet-service-fs_push.c
parent69685227863090eb24ee20d07e8c0f139264c061 (diff)
downloadgnunet-a9763a49d78b240fed1ace9068a0ea11cdff00f7.tar.gz
gnunet-a9763a49d78b240fed1ace9068a0ea11cdff00f7.zip
-eliminating #if DEBUG checks
Diffstat (limited to 'src/fs/gnunet-service-fs_push.c')
-rw-r--r--src/fs/gnunet-service-fs_push.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index 4fde823a1..22a76f332 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -31,8 +31,6 @@
31#include "gnunet-service-fs_push.h" 31#include "gnunet-service-fs_push.h"
32 32
33 33
34#define DEBUG_FS_MIGRATION GNUNET_EXTRA_LOGGING
35
36/** 34/**
37 * Maximum number of blocks we keep in memory for migration. 35 * Maximum number of blocks we keep in memory for migration.
38 */ 36 */
@@ -227,10 +225,8 @@ transmit_message (void *cls, size_t buf_size, void *buf)
227 peer->msg = NULL; 225 peer->msg = NULL;
228 if (buf == NULL) 226 if (buf == NULL)
229 { 227 {
230#if DEBUG_FS_MIGRATION
231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
232 "Failed to migrate content to another peer (disconnect)\n"); 229 "Failed to migrate content to another peer (disconnect)\n");
233#endif
234 GNUNET_free (msg); 230 GNUNET_free (msg);
235 return 0; 231 return 0;
236 } 232 }
@@ -238,10 +234,8 @@ transmit_message (void *cls, size_t buf_size, void *buf)
238 GNUNET_assert (msize <= buf_size); 234 GNUNET_assert (msize <= buf_size);
239 memcpy (buf, msg, msize); 235 memcpy (buf, msg, msize);
240 GNUNET_free (msg); 236 GNUNET_free (msg);
241#if DEBUG_FS_MIGRATION
242 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Pushing %u bytes to another peer\n", 237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Pushing %u bytes to another peer\n",
243 msize); 238 msize);
244#endif
245 find_content (peer); 239 find_content (peer);
246 return msize; 240 return msize;
247} 241}
@@ -292,10 +286,8 @@ transmit_content (struct MigrationReadyPeer *peer,
292 { 286 {
293 ret = GNUNET_NO; 287 ret = GNUNET_NO;
294 } 288 }
295#if DEBUG_FS_MIGRATION
296 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
297 "Asking for transmission of %u bytes for migration\n", msize); 290 "Asking for transmission of %u bytes for migration\n", msize);
298#endif
299 peer->th = GSF_peer_transmit_ (peer->peer, GNUNET_NO, 0 /* priority */ , 291 peer->th = GSF_peer_transmit_ (peer->peer, GNUNET_NO, 0 /* priority */ ,
300 GNUNET_TIME_UNIT_FOREVER_REL, msize, 292 GNUNET_TIME_UNIT_FOREVER_REL, msize,
301 &transmit_message, peer); 293 &transmit_message, peer);
@@ -390,16 +382,12 @@ find_content (struct MigrationReadyPeer *mrp)
390 { 382 {
391 if (mig_size < MAX_MIGRATION_QUEUE) 383 if (mig_size < MAX_MIGRATION_QUEUE)
392 { 384 {
393#if DEBUG_FS_MIGRATION
394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
395 "No content found for pushing, waiting for queue to fill\n"); 386 "No content found for pushing, waiting for queue to fill\n");
396#endif
397 return; /* will fill up eventually... */ 387 return; /* will fill up eventually... */
398 } 388 }
399#if DEBUG_FS_MIGRATION
400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 389 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
401 "No suitable content found, purging content from full queue\n"); 390 "No suitable content found, purging content from full queue\n");
402#endif
403 /* failed to find migration target AND 391 /* failed to find migration target AND
404 * queue is full, purge most-forwarded 392 * queue is full, purge most-forwarded
405 * block from queue to make room for more */ 393 * block from queue to make room for more */
@@ -419,10 +407,8 @@ find_content (struct MigrationReadyPeer *mrp)
419 consider_gathering (); 407 consider_gathering ();
420 return; 408 return;
421 } 409 }
422#if DEBUG_FS_MIGRATION
423 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 410 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
424 "Preparing to push best content to peer\n"); 411 "Preparing to push best content to peer\n");
425#endif
426 transmit_content (mrp, best); 412 transmit_content (mrp, best);
427} 413}
428 414
@@ -459,10 +445,8 @@ consider_gathering ()
459 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, mig_size); 445 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, mig_size);
460 delay = GNUNET_TIME_relative_divide (delay, MAX_MIGRATION_QUEUE); 446 delay = GNUNET_TIME_relative_divide (delay, MAX_MIGRATION_QUEUE);
461 delay = GNUNET_TIME_relative_max (delay, min_migration_delay); 447 delay = GNUNET_TIME_relative_max (delay, min_migration_delay);
462#if DEBUG_FS_MIGRATION
463 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 448 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
464 "Scheduling gathering task (queue size: %u)\n", mig_size); 449 "Scheduling gathering task (queue size: %u)\n", mig_size);
465#endif
466 mig_task = 450 mig_task =
467 GNUNET_SCHEDULER_add_delayed (delay, &gather_migration_blocks, NULL); 451 GNUNET_SCHEDULER_add_delayed (delay, &gather_migration_blocks, NULL);
468} 452}
@@ -494,9 +478,7 @@ process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size,
494 mig_qe = NULL; 478 mig_qe = NULL;
495 if (key == NULL) 479 if (key == NULL)
496 { 480 {
497#if DEBUG_FS_MIGRATION
498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No content found for migration...\n"); 481 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No content found for migration...\n");
499#endif
500 consider_gathering (); 482 consider_gathering ();
501 return; 483 return;
502 } 484 }
@@ -516,11 +498,9 @@ process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size,
516 consider_gathering (); 498 consider_gathering ();
517 return; 499 return;
518 } 500 }
519#if DEBUG_FS_MIGRATION
520 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 501 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
521 "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n", 502 "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n",
522 GNUNET_h2s (key), type, mig_size + 1, MAX_MIGRATION_QUEUE); 503 GNUNET_h2s (key), type, mig_size + 1, MAX_MIGRATION_QUEUE);
523#endif
524 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size); 504 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size);
525 mb->query = *key; 505 mb->query = *key;
526 mb->expiration = expiration; 506 mb->expiration = expiration;
@@ -534,10 +514,8 @@ process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size,
534 { 514 {
535 if (NULL == pos->th) 515 if (NULL == pos->th)
536 { 516 {
537#if DEBUG_FS_MIGRATION
538 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
539 "Preparing to push best content to peer\n"); 518 "Preparing to push best content to peer\n");
540#endif
541 if (GNUNET_YES == transmit_content (pos, mb)) 519 if (GNUNET_YES == transmit_content (pos, mb))
542 break; /* 'mb' was freed! */ 520 break; /* 'mb' was freed! */
543 } 521 }
@@ -563,11 +541,9 @@ gather_migration_blocks (void *cls,
563 return; 541 return;
564 if (GSF_dsh != NULL) 542 if (GSF_dsh != NULL)
565 { 543 {
566#if DEBUG_FS_MIGRATION
567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
568 "Asking datastore for content for replication (queue size: %u)\n", 545 "Asking datastore for content for replication (queue size: %u)\n",
569 mig_size); 546 mig_size);
570#endif
571 mig_qe = 547 mig_qe =
572 GNUNET_DATASTORE_get_for_replication (GSF_dsh, 0, UINT_MAX, 548 GNUNET_DATASTORE_get_for_replication (GSF_dsh, 0, UINT_MAX,
573 GNUNET_TIME_UNIT_FOREVER_REL, 549 GNUNET_TIME_UNIT_FOREVER_REL,