diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-03-27 12:16:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-03-27 12:16:22 +0000 |
commit | 0c3d376ccca792725f0e080dc9a16fbd56e682b0 (patch) | |
tree | 3720185a4c01458f8f992164fc802a9a7f44ae77 /src/fs/gnunet-service-fs_push.c | |
parent | 0891b05a347a9cd688364c285e7b4445d6026a5f (diff) | |
download | gnunet-0c3d376ccca792725f0e080dc9a16fbd56e682b0.tar.gz gnunet-0c3d376ccca792725f0e080dc9a16fbd56e682b0.zip |
ugh
Diffstat (limited to 'src/fs/gnunet-service-fs_push.c')
-rw-r--r-- | src/fs/gnunet-service-fs_push.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index e720f392f..58588ebdb 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c | |||
@@ -226,6 +226,11 @@ transmit_message (void *cls, | |||
226 | GNUNET_assert (msize <= buf_size); | 226 | GNUNET_assert (msize <= buf_size); |
227 | memcpy (buf, msg, msize); | 227 | memcpy (buf, msg, msize); |
228 | GNUNET_free (msg); | 228 | GNUNET_free (msg); |
229 | #if DEBUG_FS | ||
230 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
231 | "Pushing %u bytes to another peer\n", | ||
232 | msize); | ||
233 | #endif | ||
229 | find_content (peer); | 234 | find_content (peer); |
230 | return msize; | 235 | return msize; |
231 | } | 236 | } |
@@ -254,7 +259,7 @@ transmit_content (struct MigrationReadyPeer *peer, | |||
254 | msg = GNUNET_malloc (msize); | 259 | msg = GNUNET_malloc (msize); |
255 | msg->header.type = htons (42); | 260 | msg->header.type = htons (42); |
256 | msg->header.size = htons (msize); | 261 | msg->header.size = htons (msize); |
257 | 262 | GNUNET_break (0); | |
258 | memcpy (&msg[1], | 263 | memcpy (&msg[1], |
259 | &block[1], | 264 | &block[1], |
260 | block->size); | 265 | block->size); |
@@ -375,7 +380,17 @@ find_content (struct MigrationReadyPeer *mrp) | |||
375 | if (NULL == best) | 380 | if (NULL == best) |
376 | { | 381 | { |
377 | if (mig_size < MAX_MIGRATION_QUEUE) | 382 | if (mig_size < MAX_MIGRATION_QUEUE) |
378 | return; /* will fill up eventually... */ | 383 | { |
384 | #if DEBUG_FS | ||
385 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
386 | "No content found for pushing, waiting for queue to fill\n"); | ||
387 | #endif | ||
388 | return; /* will fill up eventually... */ | ||
389 | } | ||
390 | #if DEBUG_FS | ||
391 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
392 | "No suitable content found, purging content from full queue\n"); | ||
393 | #endif | ||
379 | /* failed to find migration target AND | 394 | /* failed to find migration target AND |
380 | queue is full, purge most-forwarded | 395 | queue is full, purge most-forwarded |
381 | block from queue to make room for more */ | 396 | block from queue to make room for more */ |
@@ -392,10 +407,14 @@ find_content (struct MigrationReadyPeer *mrp) | |||
392 | pos = pos->next; | 407 | pos = pos->next; |
393 | } | 408 | } |
394 | GNUNET_assert (NULL != best); | 409 | GNUNET_assert (NULL != best); |
395 | delete_migration_block (best); | 410 | delete_migration_block (best); |
396 | consider_gathering (); | 411 | consider_gathering (); |
397 | return; | 412 | return; |
398 | } | 413 | } |
414 | #if DEBUG_FS | ||
415 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
416 | "Preparing to push best content to peer\n"); | ||
417 | #endif | ||
399 | transmit_content (mrp, best); | 418 | transmit_content (mrp, best); |
400 | } | 419 | } |
401 | 420 | ||
@@ -517,6 +536,10 @@ process_migration_content (void *cls, | |||
517 | { | 536 | { |
518 | if (NULL == pos->th) | 537 | if (NULL == pos->th) |
519 | { | 538 | { |
539 | #if DEBUG_FS | ||
540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
541 | "Preparing to push best content to peer\n"); | ||
542 | #endif | ||
520 | if (GNUNET_YES == transmit_content (pos, mb)) | 543 | if (GNUNET_YES == transmit_content (pos, mb)) |
521 | break; /* 'mb' was freed! */ | 544 | break; /* 'mb' was freed! */ |
522 | } | 545 | } |