clean up
authorChristian Grothoff <christian@grothoff.org>
Sat, 7 May 2011 07:33:14 +0000 (07:33 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 7 May 2011 07:33:14 +0000 (07:33 +0000)
src/dht/gnunet-service-dht.c
src/fs/fs.c
src/fs/gnunet-pseudonym.c
src/testing/testing.c
src/testing/testing_group.c

index 1e826096cf588ea5aa6c6bf15daf27306a3cab17..630c6a35bf0c9f162c093b11684a3b73750291df 100644 (file)
@@ -2154,8 +2154,9 @@ route_result_message (struct GNUNET_MessageHeader *msg,
   struct DHTRouteSource *pos;
   struct PeerInfo *peer_info;
   const struct GNUNET_MessageHeader *hello_msg;
+#if DEBUG_DHT > 1
   unsigned int i;
-  char *path_offset;
+#endif
 
   increment_stats (STAT_RESULTS);
   /**
@@ -2271,14 +2272,18 @@ route_result_message (struct GNUNET_MessageHeader *msg,
           increment_stats (STAT_RESULTS_TO_CLIENT);
           if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_DHT_GET_RESULT)
             increment_stats (STAT_GET_REPLY);
-
+#if DEBUG_DHT > 1
           for (i = 0; i < msg_ctx->path_history_len; i++)
             {
+             char *path_offset;
+
               path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)];
-#if DEBUG_DHT > 1
-              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "(before client) Key %s Found peer %d:%s\n", GNUNET_h2s(&msg_ctx->key), i, GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset));
-#endif
+              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
+                        "(before client) Key %s Found peer %d:%s\n",
+                        GNUNET_h2s(&msg_ctx->key), i, 
+                        GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset));
             }
+#endif
           send_reply_to_client (pos->client, msg, msg_ctx);
         }
       else                      /* Send to peer */
@@ -3382,7 +3387,6 @@ select_peer (const GNUNET_HashCode * target,
   unsigned int i;
   unsigned int count;
   unsigned int offset;
-  unsigned int my_matching_bits;
   int closest_bucket;
   struct PeerInfo *pos;
   struct PeerInfo *sorted_closest[bucket_size];
@@ -3398,9 +3402,6 @@ select_peer (const GNUNET_HashCode * target,
   unsigned int largest_distance;
   struct PeerInfo *chosen;
 
-  my_matching_bits =
-    GNUNET_CRYPTO_hash_matching_bits (target, &my_identity.hashPubKey);
-
   total_distance = 0;
   /** If we are doing kademlia routing, or converge is binary (saves some cycles) */
   if ((strict_kademlia == GNUNET_YES) ||
index 307952a17bce0221e8c8a5b74a6efa5cec5aef90..fdaa12205167bd7b1bad75315ffae8f0626585c6 100644 (file)
@@ -2625,7 +2625,6 @@ deserialize_download (struct GNUNET_FS_Handle *h,
                      const char *serialization)
 {
   struct GNUNET_FS_DownloadContext *dc;
-  struct DownloadRequest *dr;
   char *emsg;
   char *uris;
   char *dn;
@@ -2634,7 +2633,6 @@ deserialize_download (struct GNUNET_FS_Handle *h,
 
   uris = NULL;
   emsg = NULL;
-  dr = NULL;
   dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext));
   dc->parent = parent;
   dc->h = h;
index d7a13e4860a71af84431292cfdb4ef18995063e7..348805904aeacc5794b3b8c150454e72515e6cf2 100644 (file)
@@ -226,7 +226,6 @@ run (void *cls,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  struct GNUNET_TIME_Absolute expiration;
   char *emsg;
 
   cfg = c;
@@ -263,7 +262,6 @@ run (void *cls,
        {
          if (NULL != root_identifier)
            {
-             expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
              if (ksk_uri == NULL)
                {
                  emsg = NULL;
index 9558f45eb287d297075d6d8cfc15ec2e1cc872f3..dafe0efbe4d194b37289074bf950cfa12a217139 100644 (file)
@@ -63,18 +63,22 @@ static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} };
  * @param message HELLO message of peer
  */
 static void
-process_hello (void *cls, const struct GNUNET_MessageHeader *message)
+process_hello (void *cls, 
+              const struct GNUNET_MessageHeader *message)
 {
   struct GNUNET_TESTING_Daemon *daemon = cls;
+#if WAIT_FOR_HELLO
   GNUNET_TESTING_NotifyDaemonRunning cb;
+#endif
 
   int msize;
   if (daemon == NULL)
     return;
 
   GNUNET_assert (daemon->phase == SP_GET_HELLO || daemon->phase == SP_START_DONE);
-
+#if WAIT_FOR_HELLO
   cb = daemon->cb;
+#endif
   daemon->cb = NULL;
   if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */
     GNUNET_SCHEDULER_cancel(daemon->task);
@@ -119,7 +123,10 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
 
 #if WAIT_FOR_HELLO
   if (NULL != cb) /* FIXME: what happens when this callback calls GNUNET_TESTING_daemon_stop? */
-    cb (daemon->cb_cls, &daemon->id, daemon->cfg, daemon, NULL);
+    cb (daemon->cb_cls, 
+       &daemon->id, 
+       daemon->cfg, 
+       daemon, NULL);
 #endif
 }
 
index b1e3beb8c8e682d02c90c11d83ef1004cf4278cc..66bcae842b99bfd9cfd6dc5baeec9bde8b089a08 100644 (file)
@@ -2424,16 +2424,17 @@ static unsigned int
 copy_allowed(struct GNUNET_TESTING_PeerGroup *pg,
              GNUNET_TESTING_ConnectionProcessor proc)
 {
-  struct UnblacklistContext un_ctx;
   unsigned int count;
   unsigned int total;
   struct PeerConnection *iter;
+#if !OLD
+  struct UnblacklistContext un_ctx;
 
   un_ctx.pg = pg;
+#endif
   total = 0;
   for (count = 0; count < pg->total - 1; count++)
     {
-      un_ctx.first_uid = count;
 #if OLD
       iter = pg->peers[count].allowed_peers_head;
       while (iter != NULL)
@@ -2443,10 +2444,15 @@ copy_allowed(struct GNUNET_TESTING_PeerGroup *pg,
           iter = iter->next;
         }
 #else
-      total += GNUNET_CONTAINER_multihashmap_iterate(pg->peers[count].allowed_peers, &unblacklist_iterator, &un_ctx);
+      un_ctx.first_uid = count;
+      total += GNUNET_CONTAINER_multihashmap_iterate(pg->peers[count].allowed_peers, 
+                                                    &unblacklist_iterator,
+                                                    &un_ctx);
 #endif
     }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unblacklisted %u peers\n", total);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+             "Unblacklisted %u peers\n", 
+             total);
   return total;
 }
 
@@ -2467,16 +2473,16 @@ create_line(struct GNUNET_TESTING_PeerGroup *pg,
             GNUNET_TESTING_ConnectionProcessor proc, enum PeerLists list)
 {
   unsigned int count;
-  int connect_attempts;
+  unsigned int connect_attempts;
 
   connect_attempts = 0;
-
   /* Connect each peer to the next highest numbered peer */
   for (count = 0; count < pg->total - 1; count++)
     {
 #if VERBOSE_TESTING
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-          "Connecting peer %d to peer %d\n", count, count + 1);
+                 "Connecting peer %d to peer %d\n", 
+                 count, count + 1);
 #endif
       connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES);
     }
@@ -2504,15 +2510,14 @@ create_from_file(struct GNUNET_TESTING_PeerGroup *pg, char *filename,
   int connect_attempts;
   unsigned int first_peer_index;
   unsigned int second_peer_index;
-  connect_attempts = 0;
   struct stat frstat;
   int count;
   char *data;
   char *buf;
   unsigned int total_peers;
-
   enum States curr_state;
 
+  connect_attempts = 0;
   if (GNUNET_OK != GNUNET_DISK_file_test (filename))
     GNUNET_DISK_fn_write (filename, NULL, 0, GNUNET_DISK_PERM_USER_READ);
 
@@ -4272,22 +4277,17 @@ void
 choose_random_connections(struct GNUNET_TESTING_PeerGroup *pg,
                           double percentage)
 {
-  struct RandomContext random_ctx;
   uint32_t pg_iter;
 #if OLD
-  struct PeerConnection *temp_peers;
   struct PeerConnection *conn_iter;
   double random_number;
+#else
+  struct RandomContext random_ctx;
 #endif
 
   for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
     {
-      random_ctx.first_uid = pg_iter;
-      random_ctx.first = &pg->peers[pg_iter];
-      random_ctx.percentage = percentage;
-      random_ctx.pg = pg;
 #if OLD
-      temp_peers = NULL;
       conn_iter = pg->peers[pg_iter].connect_peers_head;
       while (conn_iter != NULL)
         {
@@ -4303,17 +4303,21 @@ choose_random_connections(struct GNUNET_TESTING_PeerGroup *pg,
           conn_iter = conn_iter->next;
         }
 #else
-      pg->peers[pg_iter].connect_peers_working_set =
-      GNUNET_CONTAINER_multihashmap_create (pg->total);
+      random_ctx.first_uid = pg_iter;
+      random_ctx.first = &pg->peers[pg_iter];
+      random_ctx.percentage = percentage;
+      random_ctx.pg = pg;
+      pg->peers[pg_iter].connect_peers_working_set 
+       = GNUNET_CONTAINER_multihashmap_create (pg->total);
       GNUNET_CONTAINER_multihashmap_iterate (pg->peers[pg_iter].connect_peers,
-          &random_connect_iterator,
-          &random_ctx);
+                                            &random_connect_iterator,
+                                            &random_ctx);
       /* Now remove the old connections */
       GNUNET_CONTAINER_multihashmap_destroy (pg->
-          peers[pg_iter].connect_peers);
+                                            peers[pg_iter].connect_peers);
       /* And replace with the random set */
-      pg->peers[pg_iter].connect_peers =
-      pg->peers[pg_iter].connect_peers_working_set;
+      pg->peers[pg_iter].connect_peers 
+       = pg->peers[pg_iter].connect_peers_working_set;
 #endif
     }