/**
* Maximum number of blocks we keep in memory for migration.
*/
-#define MAX_MIGRATION_QUEUE 32
+#define MAX_MIGRATION_QUEUE 8
/**
* Blocks are at most migrated to this number of peers
}
#if DEBUG_FS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitting result for query `%s'\n",
+ "Transmitting result for query `%s' to peer\n",
GNUNET_h2s (&prd->query));
#endif
GNUNET_STATISTICS_update (GSF_stats,
gm = (const struct GetMessage*) message;
#if DEBUG_FS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received request for `%s'\n",
- GNUNET_h2s (&gm->query));
+ "Received request for `%s' from `%s'\n",
+ GNUNET_h2s (&gm->query),
+ GNUNET_i2s (other));
#endif
type = ntohl (gm->type);
bm = ntohl (gm->hash_bitmap);
{
if (GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value > block_time.rel_value)
{
-#if DEBUG_FS
+#if DEBUG_FS && 0
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Migration already blocked for another %llu ms\n",
(unsigned long long) GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value);
#endif
return; /* already blocked */
}
-#if DEBUG_FS
+#if DEBUG_FS && 0
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking to stop migration for %llu ms\n",
(unsigned long long) block_time.rel_value);
rp->hn = NULL;
rp->last_transmission = GNUNET_TIME_absolute_get ();
rp->transmission_counter++;
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Executing plan %p executed %u times, planning retransmission\n",
+ rp,
+ rp->transmission_counter);
+#endif
plan (pp, rp);
return msize;
}
}
/* process from priority heap */
rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap);
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Executing query plan %p\n",
+ rp);
+#endif
GNUNET_assert (NULL != rp);
msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL);
pp->pth = GSF_peer_transmit_ (pp->cp,
struct PeerPlan *pp;
struct GSF_PendingRequestData *prd;
struct GSF_RequestPlan *rp;
-
+
GSF_connected_peer_get_identity_ (cp, &id);
pp = GNUNET_CONTAINER_multihashmap_get (plans,
&id.hashPubKey);
}
prd = GSF_pending_request_get_data_ (pr);
rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan));
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Planning transmission of query `%s' to peer `%s' (%p)\n",
+ GNUNET_h2s (&prd->query),
+ GNUNET_i2s (&id),
+ rp);
+#endif
rp->pr = pr;
GNUNET_CONTAINER_DLL_insert (prd->rp_head,
prd->rp_tail,
#include "gnunet-service-fs_push.h"
+#define DEBUG_FS_MIGRATION GNUNET_NO
+
/**
* How long must content remain valid for us to consider it for migration?
* If content will expire too soon, there is clearly no point in pushing
peer->msg = NULL;
if (buf == NULL)
{
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Failed to migrate content to another peer (disconnect)\n");
#endif
GNUNET_assert (msize <= buf_size);
memcpy (buf, msg, msize);
GNUNET_free (msg);
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Pushing %u bytes to another peer\n",
msize);
{
ret = GNUNET_NO;
}
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking for transmission of %u bytes for migration\n",
msize);
{
if (mig_size < MAX_MIGRATION_QUEUE)
{
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No content found for pushing, waiting for queue to fill\n");
#endif
return; /* will fill up eventually... */
}
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No suitable content found, purging content from full queue\n");
#endif
consider_gathering ();
return;
}
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Preparing to push best content to peer\n");
#endif
MAX_MIGRATION_QUEUE);
delay = GNUNET_TIME_relative_max (delay,
min_migration_delay);
+#if DEBUG_FS_MIGRATION
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Scheduling gathering task (queue size: %u)\n",
+ mig_size);
+#endif
mig_task = GNUNET_SCHEDULER_add_delayed (delay,
&gather_migration_blocks,
NULL);
mig_qe = NULL;
if (key == NULL)
{
+#if DEBUG_FS_MIGRATION
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "No content found for migration...\n");
+#endif
consider_gathering ();
return;
}
consider_gathering ();
return;
}
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n",
GNUNET_h2s (key),
type,
mig_size + 1,
- MIGRATION_LIST_SIZE);
+ MAX_MIGRATION_QUEUE);
#endif
mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size);
mb->query = *key;
{
if (NULL == pos->th)
{
-#if DEBUG_FS
+#if DEBUG_FS_MIGRATION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Preparing to push best content to peer\n");
#endif
return;
if (GSF_dsh != NULL)
{
+#if DEBUG_FS_MIGRATION
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Asking datastore for content for replication (queue size: %u)\n",
+ mig_size);
+#endif
mig_qe = GNUNET_DATASTORE_get_for_replication (GSF_dsh,
0, UINT_MAX,
GNUNET_TIME_UNIT_FOREVER_REL,