gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r15179 - in gnunet/src: dht fs testing


From: gnunet
Subject: [GNUnet-SVN] r15179 - in gnunet/src: dht fs testing
Date: Sat, 7 May 2011 09:33:14 +0200

Author: grothoff
Date: 2011-05-07 09:33:14 +0200 (Sat, 07 May 2011)
New Revision: 15179

Modified:
   gnunet/src/dht/gnunet-service-dht.c
   gnunet/src/fs/fs.c
   gnunet/src/fs/gnunet-pseudonym.c
   gnunet/src/testing/testing.c
   gnunet/src/testing/testing_group.c
Log:
clean up


Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2011-05-07 07:21:36 UTC (rev 15178)
+++ gnunet/src/dht/gnunet-service-dht.c 2011-05-07 07:33:14 UTC (rev 15179)
@@ -2154,8 +2154,9 @@
   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 @@
           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));
+              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 @@
   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 @@
   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) ||

Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c  2011-05-07 07:21:36 UTC (rev 15178)
+++ gnunet/src/fs/fs.c  2011-05-07 07:33:14 UTC (rev 15179)
@@ -2625,7 +2625,6 @@
                      const char *serialization)
 {
   struct GNUNET_FS_DownloadContext *dc;
-  struct DownloadRequest *dr;
   char *emsg;
   char *uris;
   char *dn;
@@ -2634,7 +2633,6 @@
 
   uris = NULL;
   emsg = NULL;
-  dr = NULL;
   dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext));
   dc->parent = parent;
   dc->h = h;

Modified: gnunet/src/fs/gnunet-pseudonym.c
===================================================================
--- gnunet/src/fs/gnunet-pseudonym.c    2011-05-07 07:21:36 UTC (rev 15178)
+++ gnunet/src/fs/gnunet-pseudonym.c    2011-05-07 07:33:14 UTC (rev 15179)
@@ -226,7 +226,6 @@
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  struct GNUNET_TIME_Absolute expiration;
   char *emsg;
 
   cfg = c;
@@ -263,7 +262,6 @@
        {
          if (NULL != root_identifier)
            {
-             expiration = GNUNET_TIME_relative_to_absolute 
(GNUNET_TIME_UNIT_YEARS);
              if (ksk_uri == NULL)
                {
                  emsg = NULL;

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2011-05-07 07:21:36 UTC (rev 15178)
+++ gnunet/src/testing/testing.c        2011-05-07 07:33:14 UTC (rev 15179)
@@ -63,18 +63,22 @@
  * @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 @@
 
 #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
 }
 

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2011-05-07 07:21:36 UTC (rev 15178)
+++ gnunet/src/testing/testing_group.c  2011-05-07 07:33:14 UTC (rev 15179)
@@ -2424,16 +2424,17 @@
 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 @@
           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 @@
             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 @@
   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 @@
 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 @@
           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
     }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]