fixes
authorChristian Grothoff <christian@grothoff.org>
Thu, 31 Mar 2011 13:21:24 +0000 (13:21 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 31 Mar 2011 13:21:24 +0000 (13:21 +0000)
src/fs/Makefile.am
src/fs/fs_download.c
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_pe.c
src/fs/gnunet-service-fs_push.c

index 49d424825abc2dfdaff18067ff02bb7ac6241d90..94970019f1bb983b1de85f5cd1bcd4f351f4ca78 100644 (file)
@@ -217,6 +217,7 @@ endif
 test_fs_directory_SOURCES = \
  test_fs_directory.c
 test_fs_directory_LDADD = \
+  -lextractor \
   $(top_builddir)/src/fs/libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la  
 
@@ -241,6 +242,7 @@ test_fs_download_persistence_LDADD = \
 test_fs_file_information_SOURCES = \
  test_fs_file_information.c
 test_fs_file_information_LDADD = \
+  -lextractor \
   $(top_builddir)/src/fs/libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la  
 
@@ -342,6 +344,7 @@ perf_gnunet_service_fs_p2p_SOURCES = \
  perf_gnunet_service_fs_p2p.c
 perf_gnunet_service_fs_p2p_LDADD = \
   $(top_builddir)/src/fs/libgnunetfstest.a \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/fs/libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la  
@@ -350,6 +353,7 @@ perf_gnunet_service_fs_p2p_index_SOURCES = \
  perf_gnunet_service_fs_p2p.c
 perf_gnunet_service_fs_p2p_index_LDADD = \
   $(top_builddir)/src/fs/libgnunetfstest.a \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/fs/libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la  
@@ -358,6 +362,7 @@ perf_gnunet_service_fs_p2p_dht_SOURCES = \
  perf_gnunet_service_fs_p2p.c
 perf_gnunet_service_fs_p2p_dht_LDADD = \
   $(top_builddir)/src/fs/libgnunetfstest.a \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/fs/libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la  
@@ -366,6 +371,7 @@ perf_gnunet_service_fs_p2p_trust_SOURCES = \
  perf_gnunet_service_fs_p2p_trust.c
 perf_gnunet_service_fs_p2p_trust_LDADD = \
   $(top_builddir)/src/fs/libgnunetfstest.a \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/fs/libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la  
index 22fdd2141b5ca1837628fd0d6ff55386b9336a4d..8192b8c1f693b5d391f3cebc060369cce77926b6 100644 (file)
@@ -97,38 +97,6 @@ compute_disk_offset (uint64_t fsize,
 }
 
 
-/**
- * Given a block at the given offset and depth, calculate the offset
- * for the CHK at the given index.
- *
- * @param offset the offset of the first
- *        DBLOCK in the subtree of the 
- *        identified IBLOCK
- * @param depth the depth of the IBLOCK in the tree, 0 for DBLOCK
- * @param k which CHK in the IBLOCK are we 
- *        talking about
- * @return offset if k=0, otherwise an appropriately
- *         larger value (i.e., if depth = 1,
- *         the returned value should be offset+k*DBLOCK_SIZE)
- */
-static uint64_t
-compute_dblock_offset (uint64_t offset,
-                      unsigned int depth,
-                      unsigned int k)
-{
-  unsigned int i;
-  uint64_t lsize; /* what is the size of the sum of all DBlocks 
-                    that a CHK at depth i corresponds to? */
-
-  if (depth == 0)
-    return offset;
-  lsize = DBLOCK_SIZE;
-  for (i=1;i<depth;i++)
-    lsize *= CHK_PER_INODE;
-  return offset + k * lsize;
-}
-
-
 /**
  * Fill in all of the generic fields for a download event and call the
  * callback.
@@ -1277,9 +1245,6 @@ process_result_with_request (void *cls,
   chk = (struct ContentHashKey*) pt;
   for (i=(prc->size / sizeof(struct ContentHashKey))-1;i>=0;i--)
     {
-      off = compute_dblock_offset (dr->offset,
-                                  dr->depth,
-                                  i);
       drc = dr->children[i];
       switch (drc->state)
        {
index 0452b733293d245a67fcac2081d3d3ff7ea4e446..3298a5216fd60c2ca57e36e79106ba2e353266ad 100644 (file)
@@ -939,6 +939,18 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
              (unsigned int) bm);
 #endif
   namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL;
+  if ( (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) &&
+       (namespace == NULL) )
+    {
+      GNUNET_break_op (0);
+      return NULL;
+    }
+  if ( (type != GNUNET_BLOCK_TYPE_FS_SBLOCK) &&
+       (namespace != NULL) )
+    {
+      GNUNET_break_op (0);
+      return NULL;
+    }
   target = (0 != (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? ((const struct GNUNET_PeerIdentity*) &opt[bits++]) : NULL;
   options = 0;
   spid = 0;
index c193c1472d61273900ea30e2f50c65241d879695..e09a8567bd68b575b9b956bab3b8be8619da64b4 100644 (file)
@@ -217,7 +217,6 @@ schedule_peer_transmission (void *cls,
 {
   struct PeerPlan *pp = cls;
   struct GSF_RequestPlan *rp;
-  struct GSF_PendingRequestData *prd;
   size_t msize;
 
   pp->task = GNUNET_SCHEDULER_NO_TASK;
@@ -226,12 +225,10 @@ schedule_peer_transmission (void *cls,
   while ( (NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
          (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value == 0) )
     {
-      rp = GNUNET_CONTAINER_heap_remove_root (pp->delay_heap);
+      GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap));
       rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap,
                                             rp, 
                                             rp->priority);                                     
-      if (NULL == (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap)))
-       break;
     }   
   if (0 == GNUNET_CONTAINER_heap_get_size (pp->priority_heap))
     {
@@ -247,7 +244,6 @@ schedule_peer_transmission (void *cls,
   /* process from priority heap */
   rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap);
   GNUNET_assert (NULL != rp);
-  prd = GSF_pending_request_get_data_ (rp->pr);
   msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL);                                     
   pp->pth = GSF_peer_transmit_ (pp->cp,
                                GNUNET_YES,
index 65b15f356d9e807fff5b08af65d8b5a4945ecc67..b96ee3d1c9af08a9beee347d2d44a2b1fa989e8e 100644 (file)
@@ -404,7 +404,6 @@ find_content (struct MigrationReadyPeer *mrp)
       /* failed to find migration target AND
         queue is full, purge most-forwarded
         block from queue to make room for more */
-      score = 0;
       pos = mig_head;
       while (NULL != pos)
        {