clean up
authorChristian Grothoff <christian@grothoff.org>
Sun, 20 Jun 2010 15:28:57 +0000 (15:28 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 20 Jun 2010 15:28:57 +0000 (15:28 +0000)
TODO
src/fs/fs_directory.c
src/fs/gnunet-service-fs.c

diff --git a/TODO b/TODO
index 52864431c5978cd235c51074fc2b25eb8e9ea376..07fbc23cc3320eac481b7ef7bc02fb1ad442d375 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,8 +11,6 @@
   - implement DV transport plugin
   - implement testcases 
   - implement performance tests (needs tbench)
-* TOPOLOGY:
-  - needs more testing (especially F2F topology) & transport blacklisting
 * UTIL:
   - only connect() sockets that are ready (select()) [Nils]
     [On W32, we need to select after calling socket before doing connect etc.]
@@ -33,6 +31,8 @@
     why is it so slow? Fix! (see core_api_reliability test)
   - implement API to get notifications about bandwidth assignments to individual peers
   - implement API to get notifications about updates to liveness of individual peers (before disconnect)
+* TOPOLOGY:
+  - needs more testing (especially F2F topology) & transport blacklisting
 * TBENCH: [MW]
   - good to have for transport/DV evaluation! 
 * DHT: [Nate]
index fca2fc78639edbc5a311f90fe6bfdbe6a1a29291..744f2c821239c2afce1ddf7af6d62459dfa81bed 100644 (file)
@@ -559,6 +559,7 @@ block_align (size_t start,
               badness = cbad;
             }
         }
+      GNUNET_assert (best >= 0);
       tmp = perm[i];
       perm[i] = perm[best];
       perm[best] = tmp;
@@ -597,7 +598,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
   ssize_t ret;
   uint32_t big;
 
-  size = 8 + sizeof (uint32_t);
+  size = strlen (GNUNET_DIRECTORY_MAGIC) + sizeof (uint32_t);
   size += GNUNET_CONTAINER_meta_data_get_serialized_size (bld->meta);
   sizes = NULL;
   perm = NULL;
@@ -641,8 +642,8 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
       return GNUNET_SYSERR;
     }
   *rdata = data;
-  memcpy (data, GNUNET_DIRECTORY_MAGIC, 8);
-  off = 8;
+  memcpy (data, GNUNET_DIRECTORY_MAGIC, strlen (GNUNET_DIRECTORY_MAGIC));
+  off = strlen (GNUNET_DIRECTORY_MAGIC);
 
   sptr = &data[off + sizeof (uint32_t)];
   ret = GNUNET_CONTAINER_meta_data_serialize (bld->meta,
@@ -651,7 +652,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
                                              GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
   GNUNET_assert (ret != -1);
   big = htonl (ret);  
-  memcpy (&data[8], &big, sizeof (uint32_t));
+  memcpy (&data[off], &big, sizeof (uint32_t));
   off += sizeof (uint32_t) + ret;
   for (j = 0; j < bld->count; j++)
     {
index 1c542386c644c1c419b91b7f12a13d8ad4995dff..7c50f3a52cd02c8ddcb6790510c37771661a9c2a 100644 (file)
@@ -3084,11 +3084,12 @@ handle_p2p_get (void *cls,
   pr = GNUNET_malloc (sizeof (struct PendingRequest) + 
                      (have_ns ? sizeof(GNUNET_HashCode) : 0));
   if (have_ns)
-    pr->namespace = (GNUNET_HashCode*) &pr[1];
+    {
+      pr->namespace = (GNUNET_HashCode*) &pr[1];
+      memcpy (pr->namespace, &opt[bits++], sizeof (GNUNET_HashCode));
+    }
   pr->type = type;
   pr->mingle = ntohl (gm->filter_mutator);
-  if (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE))    
-    memcpy (&pr[1], &opt[bits++], sizeof (GNUNET_HashCode));
   if (0 != (bm & GET_MESSAGE_BIT_TRANSMIT_TO))
     pr->target_pid = GNUNET_PEER_intern ((const struct GNUNET_PeerIdentity*) &opt[bits++]);