diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/fs.h | 2 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 11 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 20 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_push.c | 34 |
4 files changed, 51 insertions, 16 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h index 2040d035a..8fa0ef0aa 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -62,7 +62,7 @@ | |||
62 | /** | 62 | /** |
63 | * Maximum number of blocks we keep in memory for migration. | 63 | * Maximum number of blocks we keep in memory for migration. |
64 | */ | 64 | */ |
65 | #define MAX_MIGRATION_QUEUE 32 | 65 | #define MAX_MIGRATION_QUEUE 8 |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Blocks are at most migrated to this number of peers | 68 | * Blocks are at most migrated to this number of peers |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 702442bb2..2aec83efe 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -658,7 +658,7 @@ handle_p2p_reply (void *cls, | |||
658 | } | 658 | } |
659 | #if DEBUG_FS | 659 | #if DEBUG_FS |
660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
661 | "Transmitting result for query `%s'\n", | 661 | "Transmitting result for query `%s' to peer\n", |
662 | GNUNET_h2s (&prd->query)); | 662 | GNUNET_h2s (&prd->query)); |
663 | #endif | 663 | #endif |
664 | GNUNET_STATISTICS_update (GSF_stats, | 664 | GNUNET_STATISTICS_update (GSF_stats, |
@@ -859,8 +859,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
859 | gm = (const struct GetMessage*) message; | 859 | gm = (const struct GetMessage*) message; |
860 | #if DEBUG_FS | 860 | #if DEBUG_FS |
861 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 861 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
862 | "Received request for `%s'\n", | 862 | "Received request for `%s' from `%s'\n", |
863 | GNUNET_h2s (&gm->query)); | 863 | GNUNET_h2s (&gm->query), |
864 | GNUNET_i2s (other)); | ||
864 | #endif | 865 | #endif |
865 | type = ntohl (gm->type); | 866 | type = ntohl (gm->type); |
866 | bm = ntohl (gm->hash_bitmap); | 867 | bm = ntohl (gm->hash_bitmap); |
@@ -1548,14 +1549,14 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, | |||
1548 | { | 1549 | { |
1549 | if (GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value > block_time.rel_value) | 1550 | if (GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value > block_time.rel_value) |
1550 | { | 1551 | { |
1551 | #if DEBUG_FS | 1552 | #if DEBUG_FS && 0 |
1552 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1553 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1553 | "Migration already blocked for another %llu ms\n", | 1554 | "Migration already blocked for another %llu ms\n", |
1554 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value); | 1555 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value); |
1555 | #endif | 1556 | #endif |
1556 | return; /* already blocked */ | 1557 | return; /* already blocked */ |
1557 | } | 1558 | } |
1558 | #if DEBUG_FS | 1559 | #if DEBUG_FS && 0 |
1559 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1560 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1560 | "Asking to stop migration for %llu ms\n", | 1561 | "Asking to stop migration for %llu ms\n", |
1561 | (unsigned long long) block_time.rel_value); | 1562 | (unsigned long long) block_time.rel_value); |
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index e09a8567b..d0e30f025 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -200,6 +200,12 @@ transmit_message_callback (void *cls, | |||
200 | rp->hn = NULL; | 200 | rp->hn = NULL; |
201 | rp->last_transmission = GNUNET_TIME_absolute_get (); | 201 | rp->last_transmission = GNUNET_TIME_absolute_get (); |
202 | rp->transmission_counter++; | 202 | rp->transmission_counter++; |
203 | #if DEBUG_FS | ||
204 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
205 | "Executing plan %p executed %u times, planning retransmission\n", | ||
206 | rp, | ||
207 | rp->transmission_counter); | ||
208 | #endif | ||
203 | plan (pp, rp); | 209 | plan (pp, rp); |
204 | return msize; | 210 | return msize; |
205 | } | 211 | } |
@@ -243,6 +249,11 @@ schedule_peer_transmission (void *cls, | |||
243 | } | 249 | } |
244 | /* process from priority heap */ | 250 | /* process from priority heap */ |
245 | rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); | 251 | rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); |
252 | #if DEBUG_FS | ||
253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
254 | "Executing query plan %p\n", | ||
255 | rp); | ||
256 | #endif | ||
246 | GNUNET_assert (NULL != rp); | 257 | GNUNET_assert (NULL != rp); |
247 | msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL); | 258 | msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL); |
248 | pp->pth = GSF_peer_transmit_ (pp->cp, | 259 | pp->pth = GSF_peer_transmit_ (pp->cp, |
@@ -270,7 +281,7 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, | |||
270 | struct PeerPlan *pp; | 281 | struct PeerPlan *pp; |
271 | struct GSF_PendingRequestData *prd; | 282 | struct GSF_PendingRequestData *prd; |
272 | struct GSF_RequestPlan *rp; | 283 | struct GSF_RequestPlan *rp; |
273 | 284 | ||
274 | GSF_connected_peer_get_identity_ (cp, &id); | 285 | GSF_connected_peer_get_identity_ (cp, &id); |
275 | pp = GNUNET_CONTAINER_multihashmap_get (plans, | 286 | pp = GNUNET_CONTAINER_multihashmap_get (plans, |
276 | &id.hashPubKey); | 287 | &id.hashPubKey); |
@@ -287,6 +298,13 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, | |||
287 | } | 298 | } |
288 | prd = GSF_pending_request_get_data_ (pr); | 299 | prd = GSF_pending_request_get_data_ (pr); |
289 | rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan)); | 300 | rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan)); |
301 | #if DEBUG_FS | ||
302 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
303 | "Planning transmission of query `%s' to peer `%s' (%p)\n", | ||
304 | GNUNET_h2s (&prd->query), | ||
305 | GNUNET_i2s (&id), | ||
306 | rp); | ||
307 | #endif | ||
290 | rp->pr = pr; | 308 | rp->pr = pr; |
291 | GNUNET_CONTAINER_DLL_insert (prd->rp_head, | 309 | GNUNET_CONTAINER_DLL_insert (prd->rp_head, |
292 | prd->rp_tail, | 310 | prd->rp_tail, |
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, |