gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8435 - in GNUnet/src/applications/dv_dht: module tools


From: gnunet
Subject: [GNUnet-SVN] r8435 - in GNUnet/src/applications/dv_dht: module tools
Date: Mon, 27 Apr 2009 13:03:47 -0600

Author: nevans
Date: 2009-04-27 13:03:47 -0600 (Mon, 27 Apr 2009)
New Revision: 8435

Modified:
   GNUnet/src/applications/dv_dht/module/cs.c
   GNUnet/src/applications/dv_dht/module/routing.c
   GNUnet/src/applications/dv_dht/module/routing.h
   GNUnet/src/applications/dv_dht/module/service.c
   GNUnet/src/applications/dv_dht/module/table.c
   GNUnet/src/applications/dv_dht/module/table.h
   GNUnet/src/applications/dv_dht/tools/dht-query.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_api.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_loopback_test.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_multi_topology_test.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c
   GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c
Log:
logging changes

Modified: GNUnet/src/applications/dv_dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/cs.c  2009-04-27 19:03:29 UTC (rev 
8434)
+++ GNUnet/src/applications/dv_dht/module/cs.c  2009-04-27 19:03:47 UTC (rev 
8435)
@@ -146,7 +146,7 @@
   cpc = GNUNET_malloc (sizeof (struct DV_DHT_CLIENT_GET_RECORD));
   cpc->client = client;
   cpc->get_record = dvdhtAPI->get_start (ntohl (get->type),
-                                       &get->key, &get_result, cpc);
+                                         &get->key, &get_result, cpc);
   GNUNET_mutex_lock (lock);
   cpc->next = getRecords;
   getRecords = cpc;

Modified: GNUnet/src/applications/dv_dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/routing.c     2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/module/routing.c     2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -35,9 +35,14 @@
 #include "gnunet_core.h"
 #include "gnunet_stats_service.h"
 #include "gnunet_dv_service.h"
+#include "gnunet_dhtlog_service.h"
 
 #define DEBUG_ROUTING GNUNET_NO
 
+#define DHTLOG_GET 1
+#define DHTLOG_PUT 2
+#define GHTLOG_RESULT 3
+
 /**
  * What is the request priority for DV_DHT operations?
  */
@@ -147,6 +152,18 @@
    */
   GNUNET_HashCode key;
 
+#if DEBUG_ROUTING
+  /*
+   * Unique query id for sql database interaction.
+   */
+  unsigned long long queryuid;
+
+  /*
+   * Unique trial id for sql database interaction
+   */
+  unsigned long long trialuid;
+#endif
+
 } DV_DHT_MESSAGE;
 
 /**
@@ -194,6 +211,23 @@
  */
 static unsigned int rt_size;
 
+/*
+ * DHTLog Service handle
+ */
+static GNUNET_dhtlog_ServiceAPI *dhtlog;
+
+/*
+ * Whether or not to send routing debugging information
+ * to the dht logging server
+ */
+static unsigned int debug_routes;
+
+/*
+ * Whether or not to send FULL route information to
+ * logging server
+ */
+static unsigned int debug_routes_extended;
+
 /**
  * Statistics service.
  */
@@ -201,6 +235,11 @@
 
 static GNUNET_Dstore_ServiceAPI *dstore;
 
+/*
+ * DHT Logging service.
+ */
+static GNUNET_dhtlog_ServiceAPI *dhtlog;
+
 static GNUNET_DV_ServiceAPI *dvapi;
 
 static struct GNUNET_Mutex *lock;
@@ -269,6 +308,8 @@
   GNUNET_CronTime now;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
+  unsigned long long trialuid;
+  unsigned long long queryuid;
 #endif
 
 #if DEBUG_ROUTING
@@ -277,6 +318,7 @@
                  GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
                  "DHT-Routing of result for key `%s'.\n", &enc);
 #endif
+
   if (cls != NULL)
     {
       result = cls;
@@ -288,8 +330,20 @@
       result->header.type = htons (GNUNET_P2P_PROTO_DHT_RESULT);
       result->type = htonl (type);
       result->hop_count = htonl (0);
-      result->network_size = htonl (GNUNET_DV_DHT_estimate_network_diameter 
());
+      result->network_size =
+        htonl (GNUNET_DV_DHT_estimate_network_diameter ());
       result->key = *key;
+#if DEBUG_ROUTING
+      if ((debug_routes) && (dhtlog != NULL))
+        {
+          dhtlog->get_trial (&trialuid);
+          dhtlog->insert_query (&queryuid, 0, trialuid, DHTLOG_RESULT,
+                                ntohl (result->hop_count), GNUNET_NO,
+                                coreAPI->my_identity, key);
+        }
+      result->queryuid = htonl (queryuid);
+      result->trialuid = htonl (trialuid);
+#endif
       memcpy (&result[1], data, size);
     }
   GNUNET_hash (data, size, &hc);
@@ -359,10 +413,20 @@
                              GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                              GNUNET_GE_DEVELOPER,
                              "Routing result to `%s'\n", &enc);
+
+              if ((debug_routes_extended) && (dhtlog != NULL))
+                {
+                  queryuid = result->queryuid;
+                  trialuid = result->trialuid;
+                  dhtlog->insert_route (NULL, queryuid, trialuid,
+                                        DHTLOG_RESULT,
+                                        ntohl (result->hop_count), GNUNET_NO,
+                                        coreAPI->my_identity, key, "",
+                                        pos->source);
+                }
 #endif
-              dvapi->dv_send(&pos->source,
-                             &result->header, DV_DHT_PRIORITY,
-                             DV_DHT_DELAY);
+              dvapi->dv_send (&pos->source,
+                              &result->header, DV_DHT_PRIORITY, DV_DHT_DELAY);
 
               if (stats != NULL)
                 stats->change (stat_replies_routed, 1);
@@ -402,7 +466,8 @@
  */
 static int
 add_route (const GNUNET_PeerIdentity * sender,
-           GNUNET_ResultProcessor handler, void *cls, const DV_DHT_MESSAGE * 
get)
+           GNUNET_ResultProcessor handler, void *cls,
+           const DV_DHT_MESSAGE * get)
 {
   DV_DHTQueryRecord *q;
   unsigned int i;
@@ -501,6 +566,8 @@
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
   GNUNET_EncName henc;
+  unsigned long long trialuid;
+  unsigned long long queryuid;
 #endif
 
   if (ntohs (msg->size) != sizeof (DV_DHT_MESSAGE))
@@ -527,6 +594,15 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Failed to add entry in routing table for request.\n");
+      if ((debug_routes) && (dhtlog != NULL))
+        {
+          hop_count = ntohl (get->hop_count);
+          trialuid = ntohl (get->trialuid);
+          queryuid = ntohl (get->queryuid);
+          dhtlog->insert_query (NULL, queryuid, get->trialuid, DHTLOG_GET,
+                                hop_count, GNUNET_NO, coreAPI->my_identity,
+                                &get->key);
+        }
 #endif
       return GNUNET_OK;         /* could not route */
     }
@@ -574,9 +650,17 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Forwarding DV_DHT GET request to peer `%s'.\n", &enc);
+      if ((debug_routes_extended) && (dhtlog != NULL))
+        {
+          hop_count = ntohl (get->hop_count);
+          trialuid = ntohl (get->trialuid);
+          queryuid = ntohl (get->queryuid);
+          dhtlog->insert_route (NULL, queryuid, trialuid, DHTLOG_GET,
+                                hop_count, GNUNET_NO, coreAPI->my_identity,
+                                &get->key, sender, &next[j]);
+        }
 #endif
-      dvapi->dv_send(&next[j], &aget.header, DV_DHT_PRIORITY,
-                     DV_DHT_DELAY);
+      dvapi->dv_send (&next[j], &aget.header, DV_DHT_PRIORITY, DV_DHT_DELAY);
       j++;
     }
   return GNUNET_OK;
@@ -600,8 +684,9 @@
   unsigned int j;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
+  unsigned long long queryuid;
+  unsigned long long trialuid
 #endif
-
   if (ntohs (msg->size) < sizeof (DV_DHT_MESSAGE))
     {
       GNUNET_GE_BREAK (NULL, 0);
@@ -655,9 +740,17 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Forwarding DV_DHT PUT request to peer `%s'.\n", &enc);
+
+      if ((debug_routes_extended) && (dhtlog != NULL))
+        {
+          trialuid = ntohl (put->trialuid);
+          queryuid = ntohl (put->queryuid);
+          dhtlog->insert_route (NULL, queryuid, trialuid, DHTLOG_PUT,
+                                ntohl (put->hop_count), GNUNET_NO,
+                                coreAPI->my_identity, key, sender, next[j]);
+        }
 #endif
-      dvapi->dv_send (&next[j], &aput->header, DV_DHT_PRIORITY,
-                                DV_DHT_DELAY);
+      dvapi->dv_send (&next[j], &aput->header, DV_DHT_PRIORITY, DV_DHT_DELAY);
       j++;
     }
   GNUNET_free (aput);
@@ -671,6 +764,15 @@
                      "Decided to cache data `%.*s' locally until %llu (for 
%llu ms)\n",
                      ntohs (put->header.size) - sizeof (DV_DHT_MESSAGE),
                      &put[1], CONTENT_LIFETIME + now, CONTENT_LIFETIME);
+
+      if ((debug_routes) && (dhtlog != NULL))
+        {
+          trialuid = ntohl (put->trialuid);
+          queryuid = ntohl (put->queryuid);
+          dhtlog->insert_query (NULL, queryuid, trialuid, DHTLOG_PUT,
+                                ntohl (put->hop_count), GNUNET_YES,
+                                coreAPI->my_identity, key);
+        }
 #endif
       dstore->put (&put->key,
                    ntohl (put->type),
@@ -717,6 +819,14 @@
   GNUNET_GE_LOG (coreAPI->ectx,
                  GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
                  "Received REMOTE DV_DHT RESULT for key `%s'.\n", &enc);
+  if ((debug_routes_extended) && (dhtlog != NULL))
+    {
+      queryuid = result->queryuid;
+      trialuid = result->trialuid;
+      dhtlog->insert_route (NULL, queryuid, trialuid, DHTLOG_RESULT,
+                            ntohl (result->hop_count), GNUNET_YES,
+                            coreAPI->my_identity, key, sender, "");
+    }
 #endif
   route_result (&result->key,
                 ntohl (result->type),
@@ -730,12 +840,16 @@
  */
 int
 GNUNET_DV_DHT_get_start (const GNUNET_HashCode * key,
-                      unsigned int type, GNUNET_ResultProcessor handler,
-                      void *cls)
+                         unsigned int type, GNUNET_ResultProcessor handler,
+                         void *cls)
 {
   DV_DHT_MESSAGE get;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
+  unsigned long long queryuid;
+  unsigned long long trialuid;
+  queryuid = 0;
+  trialuid = 0;
 #endif
 
   get.header.size = htons (sizeof (DV_DHT_MESSAGE));
@@ -745,11 +859,20 @@
   get.network_size = htonl (GNUNET_DV_DHT_estimate_network_diameter ());
   get.key = *key;
 #if DEBUG_ROUTING
+  if ((debug_routes) && (dhtlog != NULL))
+    {
+      dhtlog->get_trial (&trialuid);
+      dhtlog->insert_query (&queryuid, 0, trialuid, DHTLOG_GET, 0, GNUNET_NO,
+                            coreAPI->my_identity, key);
+    }
+  get.queryuid = htonl (queryuid);
+  get.trialuid = htonl (trialuid);
   GNUNET_hash_to_enc (&get.key, &enc);
   GNUNET_GE_LOG (coreAPI->ectx,
                  GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_DEVELOPER,
                  "Initiating DV_DHT GET (based on local request) for key 
`%s'.\n",
                  &enc);
+
 #endif
   if (GNUNET_OK != add_route (NULL, handler, cls, &get))
     return GNUNET_SYSERR;
@@ -763,8 +886,8 @@
  */
 int
 GNUNET_DV_DHT_get_stop (const GNUNET_HashCode * key,
-                     unsigned int type, GNUNET_ResultProcessor handler,
-                     void *cls)
+                        unsigned int type, GNUNET_ResultProcessor handler,
+                        void *cls)
 {
   unsigned int i;
   struct DV_DHT_Source_Route *pos;
@@ -820,17 +943,31 @@
  */
 int
 GNUNET_DV_DHT_put (const GNUNET_HashCode * key,
-                unsigned int type, unsigned int size, const char *data)
+                   unsigned int type, unsigned int size, const char *data)
 {
   DV_DHT_MESSAGE *put;
-
-  put = GNUNET_malloc (sizeof (DV_DHT_MESSAGE) + size);
+#if DEBUG_ROUTING
+  unsigned long long queryuid;
+  unsigned long long trialuid
+#endif
+    put = GNUNET_malloc (sizeof (DV_DHT_MESSAGE) + size);
   put->header.size = htons (sizeof (DV_DHT_MESSAGE) + size);
   put->header.type = htons (GNUNET_P2P_PROTO_DHT_PUT);
   put->key = *key;
   put->type = htonl (type);
   put->hop_count = htonl (0);
   put->network_size = htonl (GNUNET_DV_DHT_estimate_network_diameter ());
+#if DEBUG_ROUTING
+  if ((debug_routes) && (dhtlog != NULL))
+    {
+      dhtlog->get_trial (&trialuid);
+      dhtlog->insert_query (&queryuid, 0, trialuid, DHTLOG_PUT,
+                            ntohl (put->hop_count), GNUNET_NO,
+                            coreAPI->my_identity, key);
+    }
+  put->queryuid = htonl (queryuid);
+  put->trialuid = htonl (trialuid);
+#endif
   memcpy (&put[1], data, size);
   handle_put (NULL, &put->header);
   GNUNET_free (put);
@@ -907,6 +1044,27 @@
                                             &handle_result);
   coreAPI->send_callback_register (sizeof (DV_DHT_MESSAGE), 0,
                                    &extra_get_callback);
+
+  if (GNUNET_YES ==
+      GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg, "DHT", "LOGSQL",
+                                               GNUNET_NO))
+    {
+      debug_routes = GNUNET_YES;
+    }
+  if (GNUNET_YES ==
+      GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg, "DHT",
+                                               "LOGSQLEXTENDED", GNUNET_NO))
+    {
+      debug_routes = GNUNET_YES;
+      debug_routes_extended = GNUNET_YES;
+    }
+
+  if (debug_routes)
+    {
+      dhtlog = coreAPI->service_request ("dhtlog_mysql");
+      GNUNET_GE_ASSERT (coreAPI->ectx, dhtlog != NULL);
+    }
+
   return GNUNET_OK;
 }
 
@@ -934,6 +1092,12 @@
       coreAPI->service_release (stats);
       stats = NULL;
     }
+
+  if (dhtlog != NULL)
+    {
+      coreAPI->service_release (dhtlog);
+      dhtlog = NULL;
+    }
   GNUNET_mutex_destroy (lock);
   for (i = 0; i < rt_size; i++)
     {

Modified: GNUnet/src/applications/dv_dht/module/routing.h
===================================================================
--- GNUnet/src/applications/dv_dht/module/routing.h     2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/module/routing.h     2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -35,16 +35,16 @@
  * Start a DV_DHT get operation.
  */
 int GNUNET_DV_DHT_get_start (const GNUNET_HashCode * key,
-                          unsigned int type, GNUNET_ResultProcessor handler,
-                          void *cls);
+                             unsigned int type,
+                             GNUNET_ResultProcessor handler, void *cls);
 
 /**
  * Stop a DV_DHT get operation (prevents calls to
  * the given iterator).
  */
 int GNUNET_DV_DHT_get_stop (const GNUNET_HashCode * key,
-                         unsigned int type, GNUNET_ResultProcessor handler,
-                         void *cls);
+                            unsigned int type, GNUNET_ResultProcessor handler,
+                            void *cls);
 
 /**
  * Perform a DV_DHT put operation.  Note that PUT operations always
@@ -54,7 +54,8 @@
  * @param expiration_time absolute expiration time
  */
 int GNUNET_DV_DHT_put (const GNUNET_HashCode * key,
-                    unsigned int type, unsigned int size, const char *data);
+                       unsigned int type, unsigned int size,
+                       const char *data);
 
 /**
  * Initialize routing DV_DHT component.

Modified: GNUnet/src/applications/dv_dht/module/service.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/service.c     2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/module/service.c     2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -52,8 +52,8 @@
  */
 static struct GNUNET_DV_DHT_GetHandle *
 dv_dht_get_async_start (unsigned int type,
-                     const GNUNET_HashCode * key,
-                     GNUNET_ResultProcessor callback, void *cls)
+                        const GNUNET_HashCode * key,
+                        GNUNET_ResultProcessor callback, void *cls)
 {
   struct GNUNET_DV_DHT_GetHandle *ret;
 
@@ -77,7 +77,7 @@
 dv_dht_get_async_stop (struct GNUNET_DV_DHT_GetHandle *record)
 {
   GNUNET_DV_DHT_get_stop (&record->key, record->type, record->callback,
-                       record->cls);
+                          record->cls);
   GNUNET_free (record);
   return GNUNET_OK;
 }

Modified: GNUnet/src/applications/dv_dht/module/table.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/table.c       2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/module/table.c       2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -201,6 +201,7 @@
 
 static int stat_dht_advertisements;
 
+
 /**
  * The struct is followed by zero or more
  * PeerIdentities that the sender knows to
@@ -356,9 +357,9 @@
  */
 int
 GNUNET_DV_DHT_select_peer (GNUNET_PeerIdentity * set,
-                        const GNUNET_HashCode * target,
-                        const GNUNET_PeerIdentity * blocked,
-                        unsigned int blocked_size)
+                           const GNUNET_HashCode * target,
+                           const GNUNET_PeerIdentity * blocked,
+                           unsigned int blocked_size)
 {
   unsigned long long total_distance;
   unsigned long long selected;
@@ -439,8 +440,7 @@
  * Find the actual, closest peer in our buckets to target
  */
 int
-find_closest_peer (GNUNET_PeerIdentity * set,
-                        const GNUNET_HashCode * target)
+find_closest_peer (GNUNET_PeerIdentity * set, const GNUNET_HashCode * target)
 {
   unsigned int largest_distance;
   unsigned int total_distance;
@@ -460,17 +460,18 @@
       for (ec = 0; ec < bucket->peers_size; ec++)
         {
           pi = bucket->peers[ec];
-          if (inverse_distance (target, &pi->id.hashPubKey) > largest_distance)
+          if (inverse_distance (target, &pi->id.hashPubKey) >
+              largest_distance)
             chosen = bucket->peers[ec];
         }
     }
 
   GNUNET_mutex_unlock (lock);
   if ((largest_distance > 0) && (chosen != NULL))
-  {
-    *set = chosen->id;
-    return GNUNET_OK;
-  }
+    {
+      *set = chosen->id;
+      return GNUNET_OK;
+    }
   else
     return GNUNET_SYSERR;
 }
@@ -493,9 +494,9 @@
   if (disco != NULL)
     {
       dvapi->dv_send (other,
-                                &disco->header,
-                                GNUNET_EXTREME_PRIORITY / 4,
-                                MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
+                      &disco->header,
+                      GNUNET_EXTREME_PRIORITY / 4,
+                      MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
       return;
     }
   pc = total_peers;
@@ -528,7 +529,7 @@
   disco->header.size =
     htons (pc * sizeof (GNUNET_PeerIdentity) + sizeof (P2P_DV_DHT_Discovery));
   dvapi->dv_send (other, &disco->header, 0,
-                            MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
+                  MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
   GNUNET_free (disco);
 }
 
@@ -553,11 +554,11 @@
       disc.header.size = htons (sizeof (P2P_DV_DHT_Discovery));
       disc.header.type = htons (GNUNET_P2P_PROTO_DHT_DISCOVERY);
       disc.space_available = -1;        /* FIXME */
-      dvapi->dv_connections_iterate(&broadcast_dht_discovery_prob, &disc);
+      dvapi->dv_connections_iterate (&broadcast_dht_discovery_prob, &disc);
     }
   else
     {
-      dvapi->dv_connections_iterate(&broadcast_dht_discovery_prob, NULL);
+      dvapi->dv_connections_iterate (&broadcast_dht_discovery_prob, NULL);
     }
 }
 
@@ -678,8 +679,8 @@
       ask.header.type = htons (sizeof (GNUNET_P2P_PROTO_DHT_ASK_HELLO));
       ask.reserved = 0;
       ask.peer = *peer;
-      dvapi->dv_send (sender, &ask.header, 0, /* FIXME: priority */
-                                5 * GNUNET_CRON_SECONDS);
+      dvapi->dv_send (sender, &ask.header, 0,   /* FIXME: priority */
+                      5 * GNUNET_CRON_SECONDS);
       return;
     }
   GNUNET_free (hello);
@@ -770,8 +771,7 @@
                               GNUNET_NO);
   if (hello == NULL)
     return GNUNET_OK;
-  dvapi->dv_send (sender, &hello->header, 0,
-                            5 * GNUNET_CRON_SECONDS);
+  dvapi->dv_send (sender, &hello->header, 0, 5 * GNUNET_CRON_SECONDS);
   GNUNET_free (hello);
   return GNUNET_OK;
 }
@@ -830,7 +830,8 @@
       stat_dht_discoveries =
         stats->create (gettext_noop ("# dv_dht discovery messages received"));
       stat_dht_route_looks =
-        stats->create (gettext_noop ("# dv_dht route host lookups performed"));
+        stats->
+        create (gettext_noop ("# dv_dht route host lookups performed"));
       stat_dht_advertisements =
         stats->create (gettext_noop ("# dv_dht discovery messages sent"));
     }
@@ -846,6 +847,7 @@
                                                NULL);
   GNUNET_cron_add_job (coreAPI->cron, &maintain_dht_job, MAINTAIN_FREQUENCY,
                        MAINTAIN_FREQUENCY, NULL);
+
   return GNUNET_OK;
 }
 
@@ -877,6 +879,7 @@
   identity = NULL;
   coreAPI->service_release (pingpong);
   pingpong = NULL;
+
   for (i = 0; i < bucketCount; i++)
     {
       for (j = 0; j < buckets[i].peers_size; j++)

Modified: GNUnet/src/applications/dv_dht/module/table.h
===================================================================
--- GNUnet/src/applications/dv_dht/module/table.h       2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/module/table.h       2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -44,9 +44,9 @@
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int GNUNET_DV_DHT_select_peer (GNUNET_PeerIdentity * set,
-                            const GNUNET_HashCode * target,
-                            const GNUNET_PeerIdentity * blocked,
-                            unsigned int blocked_size);
+                               const GNUNET_HashCode * target,
+                               const GNUNET_PeerIdentity * blocked,
+                               unsigned int blocked_size);
 
 /**
  * Compute a (rough) estimate of the networks diameter.

Modified: GNUnet/src/applications/dv_dht/tools/dht-query.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dht-query.c    2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dht-query.c    2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -84,7 +84,7 @@
                  "Issuing `%s(%s)' command.\n", "get", key);
 #endif
   ret = GNUNET_DV_DHT_get_start (ctx, GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &hc);
+                                 &hc);
   if (ret == NULL)
     {
       printf ("`%s(%s)' failed.\n", "get", key);
@@ -107,8 +107,9 @@
                  _("Issuing `%s(%s,%s)' command.\n"), "put", key, value);
 #endif
   if (GNUNET_OK ==
-      GNUNET_DV_DHT_put (cfg, ectx, &hc, 
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                      strlen (value), value))
+      GNUNET_DV_DHT_put (cfg, ectx, &hc,
+                         GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                         strlen (value), value))
     {
       printf ("`%s(%s,%s)' succeeded\n", "put", key, value);
     }

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_api.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_api.c   2009-04-27 19:03:29 UTC 
(rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_api.c   2009-04-27 19:03:47 UTC 
(rev 8435)
@@ -175,11 +175,11 @@
  */
 struct GNUNET_DV_DHT_Context *
 GNUNET_DV_DHT_context_create (struct GNUNET_GC_Configuration
-                           *cfg,
-                           struct GNUNET_GE_Context
-                           *ectx,
-                           GNUNET_ResultProcessor
-                           resultCallback, void *resCallbackClosure)
+                              *cfg,
+                              struct GNUNET_GE_Context
+                              *ectx,
+                              GNUNET_ResultProcessor
+                              resultCallback, void *resCallbackClosure)
 {
   struct GNUNET_DV_DHT_Context *ctx;
   struct GNUNET_ClientServerConnection *sock;
@@ -214,7 +214,7 @@
  */
 struct GNUNET_DV_DHT_GetRequest *
 GNUNET_DV_DHT_get_start (struct GNUNET_DV_DHT_Context *ctx,
-                      unsigned int type, const GNUNET_HashCode * key)
+                         unsigned int type, const GNUNET_HashCode * key)
 {
   struct GNUNET_DV_DHT_GetRequest *req;
 
@@ -242,7 +242,7 @@
  */
 int
 GNUNET_DV_DHT_get_stop (struct GNUNET_DV_DHT_Context *ctx,
-                     struct GNUNET_DV_DHT_GetRequest *req)
+                        struct GNUNET_DV_DHT_GetRequest *req)
 {
   CS_dht_request_get_MESSAGE creq;
 
@@ -293,9 +293,9 @@
  */
 int
 GNUNET_DV_DHT_put (struct GNUNET_GC_Configuration *cfg,
-                struct GNUNET_GE_Context *ectx,
-                const GNUNET_HashCode * key,
-                unsigned int type, unsigned int size, const char *value)
+                   struct GNUNET_GE_Context *ectx,
+                   const GNUNET_HashCode * key,
+                   unsigned int type, unsigned int size, const char *value)
 {
   struct GNUNET_ClientServerConnection *sock;
   CS_dht_request_put_MESSAGE *req;

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c       
2009-04-27 19:03:29 UTC (rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c       
2009-04-27 19:03:47 UTC (rev 8435)
@@ -90,24 +90,25 @@
                                             ectx,
                                             "NETWORK", "HOST",
                                             "localhost:2087");
-  ctx = GNUNET_DV_DHT_context_create (cfg, ectx, &result_callback, unused_cls);
+  ctx =
+    GNUNET_DV_DHT_context_create (cfg, ectx, &result_callback, unused_cls);
   CHECK (ctx != NULL);
   /* actual test code */
   GNUNET_hash ("expired_key", 4, &key);
   value = GNUNET_malloc (8);
   memset (value, 'A', 8);
   CHECK (GNUNET_OK == GNUNET_DV_DHT_put (cfg,
-                                      ectx,
-                                      &key,
-                                      
GNUNET_ECRS_BLOCKTYP_DV_DHT_STRING2STRING,
-                                      8, value));
+                                         ectx,
+                                         &key,
+                                         
GNUNET_ECRS_BLOCKTYP_DV_DHT_STRING2STRING,
+                                         8, value));
   /* FIXME: this value has to be >> than the expiration
      time (which is currently fixed to 12h, so we can not
      really do this test in practice... */
   GNUNET_thread_sleep (60 * GNUNET_CRON_SECONDS);
   CHECK (1 == GNUNET_DV_DHT_get_start (ctx,
-                                    GNUNET_ECRS_BLOCKTYP_DV_DHT_STRING2STRING,
-                                    &key));
+                                       
GNUNET_ECRS_BLOCKTYP_DV_DHT_STRING2STRING,
+                                       &key));
   GNUNET_thread_sleep (15 * GNUNET_CRON_SECONDS);
   GNUNET_DV_DHT_context_destroy (ctx);
 

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c       
2009-04-27 19:03:29 UTC (rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c       
2009-04-27 19:03:47 UTC (rev 8435)
@@ -197,10 +197,10 @@
           GNUNET_hash (buf, strlen (buf), &key);
           memset (value, 'A' + i, sizeof (value));
           CHECK (GNUNET_OK == GNUNET_DV_DHT_put (cfg,
-                                              ectx,
-                                              &key,
-                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                              sizeof (value), value));
+                                                 ectx,
+                                                 &key,
+                                                 
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                                 sizeof (value), value));
         }
       printf ("\n");
       /* get loop */
@@ -212,7 +212,8 @@
           GNUNET_GC_set_configuration_value_string (cfg,
                                                     ectx, "NETWORK", "HOST",
                                                     buf);
-          dctx = GNUNET_DV_DHT_context_create (cfg, ectx, &result_callback, 
&c);
+          dctx =
+            GNUNET_DV_DHT_context_create (cfg, ectx, &result_callback, &c);
           printf ("Peer %d gets key", i);
           fflush (stdout);
           for (j = 0; j < NUM_PEERS; j++)
@@ -227,8 +228,8 @@
               fflush (stdout);
               last = found;
               get1 = GNUNET_DV_DHT_get_start (dctx,
-                                           
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                           &key);
+                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                              &key);
               GNUNET_GE_ASSERT (NULL, get1 != NULL);
               for (k = 0; k < NUM_ROUNDS; k++)
                 {

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_loopback_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_loopback_test.c 2009-04-27 
19:03:29 UTC (rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_loopback_test.c 2009-04-27 
19:03:47 UTC (rev 8435)
@@ -114,22 +114,22 @@
   value = GNUNET_malloc (8);
   memset (value, 'A', 8);
   CHECK (GNUNET_OK == GNUNET_DV_DHT_put (cfg,
-                                      ectx,
-                                      &key,
-                                      GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                      8, value));
+                                         ectx,
+                                         &key,
+                                         
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                         8, value));
   i = 'A';
   CHECK (NULL != (get1 = GNUNET_DV_DHT_get_start (ctx,
-                                               
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                               &key)));
+                                                  
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                                  &key)));
   GNUNET_hash ("key_for_B", 3, &key);
   value = GNUNET_malloc (8);
   memset (value, 'B', 8);
   CHECK (GNUNET_OK == GNUNET_DV_DHT_put (cfg,
-                                      ectx,
-                                      &key,
-                                      GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                      8, value));
+                                         ectx,
+                                         &key,
+                                         
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                         8, value));
   left = 10;
   while ((found == 0) && (--left >= 0))
     GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);
@@ -139,8 +139,8 @@
   GNUNET_DV_DHT_get_stop (ctx, get1);
   i = 'B';
   CHECK (NULL != (get2 = GNUNET_DV_DHT_get_start (ctx,
-                                               
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                               &key)));
+                                                  
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                                  &key)));
   left = 10;
   while ((found == 0) && (--left >= 0))
     GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_multi_topology_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_multi_topology_test.c   
2009-04-27 19:03:29 UTC (rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_multi_topology_test.c   
2009-04-27 19:03:47 UTC (rev 8435)
@@ -123,8 +123,8 @@
       return -1;
     }
   GNUNET_GC_set_configuration_value_string (cfg, NULL,
-                                          "MULTIPLE_SERVER_TESTING",
-                                          "DOT_OUTPUT", "topology.dot");
+                                            "MULTIPLE_SERVER_TESTING",
+                                            "DOT_OUTPUT", "topology.dot");
   printf ("Starting %u peers...\n", NUM_PEERS);
   peers = GNUNET_REMOTE_start_daemons (cfg, NUM_PEERS);
   if (peers == NULL)
@@ -134,10 +134,10 @@
     }
   pos = peers;
   for (i = 0; i < NUM_PEERS; i++)
-  {
-    peer_array[i] = pos;
-    pos = pos->next;
-  }
+    {
+      peer_array[i] = pos;
+      pos = pos->next;
+    }
 
   found = 0;
   for (r = 0; r < NUM_REPEAT; r++)
@@ -162,7 +162,8 @@
           fflush (stdout);
           GNUNET_snprintf (buf, sizeof (buf), "localhost:%u", 2087 + i * 10);
           /* wait for some DV_DHT's to find each other! */
-          sock = GNUNET_client_connection_create (NULL, peer_array[i]->config);
+          sock =
+            GNUNET_client_connection_create (NULL, peer_array[i]->config);
           left = 30;            /* how many iterations should we wait? */
           while (GNUNET_OK ==
                  GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect,
@@ -196,10 +197,10 @@
           GNUNET_hash (buf, strlen (buf), &key);
           memset (value, 'A' + i, sizeof (value));
           CHECK (GNUNET_OK == GNUNET_DV_DHT_put (peer_array[i]->config,
-                                              ectx,
-                                              &key,
-                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                              sizeof (value), value));
+                                                 ectx,
+                                                 &key,
+                                                 
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                                 sizeof (value), value));
         }
       printf ("\n");
       /* get loop */
@@ -209,7 +210,9 @@
             break;
           GNUNET_snprintf (buf, sizeof (buf), "localhost:%u", 2087 + i * 10);
 
-          dctx = GNUNET_DV_DHT_context_create (peer_array[i]->config, ectx, 
&result_callback, &c);
+          dctx =
+            GNUNET_DV_DHT_context_create (peer_array[i]->config, ectx,
+                                          &result_callback, &c);
           printf ("Peer %d gets key", i);
           fflush (stdout);
           for (j = 0; j < NUM_PEERS; j++)
@@ -224,8 +227,8 @@
               fflush (stdout);
               last = found;
               get1 = GNUNET_DV_DHT_get_start (dctx,
-                                           
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                           &key);
+                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                              &key);
               GNUNET_GE_ASSERT (NULL, get1 != NULL);
               for (k = 0; k < NUM_ROUNDS; k++)
                 {

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c        
2009-04-27 19:03:29 UTC (rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c        
2009-04-27 19:03:47 UTC (rev 8435)
@@ -197,10 +197,10 @@
           GNUNET_hash (buf, strlen (buf), &key);
           memset (value, 'A' + i, sizeof (value));
           CHECK (GNUNET_OK == GNUNET_DV_DHT_put (cfg,
-                                              ectx,
-                                              &key,
-                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                              sizeof (value), value));
+                                                 ectx,
+                                                 &key,
+                                                 
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                                 sizeof (value), value));
         }
       printf ("\n");
       /* get loop */
@@ -212,7 +212,8 @@
           GNUNET_GC_set_configuration_value_string (cfg,
                                                     ectx, "NETWORK", "HOST",
                                                     buf);
-          dctx = GNUNET_DV_DHT_context_create (cfg, ectx, &result_callback, 
&c);
+          dctx =
+            GNUNET_DV_DHT_context_create (cfg, ectx, &result_callback, &c);
           printf ("Peer %d gets key", i);
           fflush (stdout);
           for (j = 0; j < NUM_PEERS; j++)
@@ -227,8 +228,8 @@
               fflush (stdout);
               last = found;
               get1 = GNUNET_DV_DHT_get_start (dctx,
-                                           
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                           &key);
+                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                              &key);
               GNUNET_GE_ASSERT (NULL, get1 != NULL);
               for (k = 0; k < NUM_ROUNDS; k++)
                 {

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c  2009-04-27 
19:03:29 UTC (rev 8434)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c  2009-04-27 
19:03:47 UTC (rev 8435)
@@ -124,10 +124,10 @@
   GNUNET_hash (keys, 5, &key);
   memset (value, val, sizeof (value));
   CHECK (GNUNET_OK == GNUNET_DV_DHT_put (pd->cfg,
-                                      NULL,
-                                      &key,
-                                      GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                      sizeof (value), value));
+                                         NULL,
+                                         &key,
+                                         
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                         sizeof (value), value));
 FAILURE:
   return ret;
 }
@@ -144,8 +144,8 @@
   pd->peercount = 10;
   pd->expect_i = want;
   CHECK (NULL != (get = GNUNET_DV_DHT_get_start (pd->ctx_peer,
-                                              
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                                              &key)));
+                                                 
GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
+                                                 &key)));
   for (k = 0; k < NUM_ROUNDS; k++)
     {
       if (0 == (k % 10))





reply via email to

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