stuff
authorChristian Grothoff <christian@grothoff.org>
Tue, 19 Apr 2011 21:01:44 +0000 (21:01 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 19 Apr 2011 21:01:44 +0000 (21:01 +0000)
src/fs/fs.h
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_pe.c
src/fs/gnunet-service-fs_push.c

index 2040d035aeb5ada39c1a6cfdb5edaf1f4741dcba..8fa0ef0aa1eb5b6d50fd0e28ec9757d039fb9611 100644 (file)
@@ -62,7 +62,7 @@
 /**
  * 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
index 702442bb248dac4f82225da2a7031d81fe653a65..2aec83efe23beb46db7931a38e01051a30f42ebe 100644 (file)
@@ -658,7 +658,7 @@ handle_p2p_reply (void *cls,
     }
 #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,
@@ -859,8 +859,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
   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);
@@ -1548,14 +1549,14 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
 {
   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);
index e09a8567bd68b575b9b956bab3b8be8619da64b4..d0e30f02530a2a5503237ec8ff8503e660dcf3d2 100644 (file)
@@ -200,6 +200,12 @@ transmit_message_callback (void *cls,
   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;
 }
@@ -243,6 +249,11 @@ schedule_peer_transmission (void *cls,
     }
   /* 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,
@@ -270,7 +281,7 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *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);
@@ -287,6 +298,13 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp,
     }
   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,
index 90e888b6a22e3945bca2d202ab880f405f2092d5..e4ba2d7639c11c32f4e6a9204dbbdcab2205cf8f 100644 (file)
@@ -31,6 +31,8 @@
 #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
@@ -219,7 +221,7 @@ transmit_message (void *cls,
   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
@@ -230,7 +232,7 @@ transmit_message (void *cls,
   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);
@@ -287,7 +289,7 @@ transmit_content (struct MigrationReadyPeer *peer,
     {
       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);
@@ -391,13 +393,13 @@ find_content (struct MigrationReadyPeer *mrp)
     {
       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
@@ -420,7 +422,7 @@ find_content (struct MigrationReadyPeer *mrp)
       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
@@ -463,6 +465,11 @@ consider_gathering ()
                                       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);
@@ -500,6 +507,10 @@ process_migration_content (void *cls,
   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;
     }
@@ -521,13 +532,13 @@ process_migration_content (void *cls,
        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;
@@ -545,7 +556,7 @@ process_migration_content (void *cls,
     {
       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
@@ -574,6 +585,11 @@ gather_migration_blocks (void *cls,
     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,