gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r8580 - in GNUnet/src/applications/dv_dht: module tools
Date: Mon, 15 Jun 2009 11:42:25 -0600

Author: nevans
Date: 2009-06-15 11:42:25 -0600 (Mon, 15 Jun 2009)
New Revision: 8580

Modified:
   GNUnet/src/applications/dv_dht/module/Makefile.am
   GNUnet/src/applications/dv_dht/module/cs.c
   GNUnet/src/applications/dv_dht/module/routing.c
   GNUnet/src/applications/dv_dht/module/service.c
   GNUnet/src/applications/dv_dht/module/table.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_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
   GNUnet/src/applications/dv_dht/tools/dv_test.conf
   GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf
Log:
dv_dht changes

Modified: GNUnet/src/applications/dv_dht/module/Makefile.am
===================================================================
--- GNUnet/src/applications/dv_dht/module/Makefile.am   2009-06-15 17:42:01 UTC 
(rev 8579)
+++ GNUnet/src/applications/dv_dht/module/Makefile.am   2009-06-15 17:42:25 UTC 
(rev 8580)
@@ -7,16 +7,16 @@
 plugindir = $(libdir)/GNUnet
 
 plugin_LTLIBRARIES = \
-  libgnunetmodule_dvdht.la 
+  libgnunetmodule_dv_dht.la 
 
-libgnunetmodule_dvdht_la_SOURCES = \
+libgnunetmodule_dv_dht_la_SOURCES = \
   cs.c \
   routing.c routing.h \
   service.c service.h \
   table.c table.h 
-libgnunetmodule_dvdht_la_LDFLAGS = \
+libgnunetmodule_dv_dht_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
-libgnunetmodule_dvdht_la_LIBADD = -lm \
+libgnunetmodule_dv_dht_la_LIBADD = -lm \
   $(top_builddir)/src/applications/rpc/libgnunetrpcutil.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBINTL)

Modified: GNUnet/src/applications/dv_dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/cs.c  2009-06-15 17:42:01 UTC (rev 
8579)
+++ GNUnet/src/applications/dv_dht/module/cs.c  2009-06-15 17:42:25 UTC (rev 
8580)
@@ -110,7 +110,7 @@
     }
   msg = GNUNET_malloc (n);
   msg->header.size = htons (n);
-  msg->header.type = htons (GNUNET_CS_PROTO_DHT_REQUEST_PUT);
+  msg->header.type = htons (GNUNET_CS_PROTO_DV_DHT_REQUEST_PUT);
   msg->type = htonl (type);
   msg->key = *key;
   memcpy (&msg[1], value, size);
@@ -207,7 +207,7 @@
 static void
 csClientExit (struct GNUNET_ClientHandle *client)
 {
-  struct GNUNET_DHT_GetHandle *gr;
+  struct GNUNET_DV_DHT_GetHandle *gr;
   struct DV_DHT_CLIENT_GET_RECORD *pos;
   struct DV_DHT_CLIENT_GET_RECORD *prev;
 
@@ -237,40 +237,46 @@
 }
 
 int
-initialize_module_dht (GNUNET_CoreAPIForPlugins * capi)
+initialize_module_dv_dht (GNUNET_CoreAPIForPlugins * capi)
 {
   int status;
+  GNUNET_GE_LOG (capi->ectx,
+                 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                 GNUNET_GE_BULK,
+                 _("`%s' registering client handlers: %d %d %d\n"),
+                 "dv_dht", GNUNET_CS_PROTO_DV_DHT_REQUEST_PUT,
+                 GNUNET_CS_PROTO_DV_DHT_REQUEST_GET,
+                 GNUNET_CS_PROTO_DV_DHT_REQUEST_GET_END);
 
   dvdhtAPI = capi->service_request ("dv_dht");
   if (dvdhtAPI == NULL)
     return GNUNET_SYSERR;
   coreAPI = capi;
-  GNUNET_GE_LOG (coreAPI->ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                 _("`%s' registering client handlers: %d %d\n"),
-                 "dht", GNUNET_CS_PROTO_DHT_REQUEST_PUT,
-                 GNUNET_CS_PROTO_DHT_REQUEST_GET);
+
   status = GNUNET_OK;
   lock = GNUNET_mutex_create (GNUNET_NO);
   if (GNUNET_SYSERR ==
-      capi->cs_handler_register (GNUNET_CS_PROTO_DV_DHT_REQUEST_PUT, &csPut))
+      coreAPI->cs_handler_register (GNUNET_CS_PROTO_DV_DHT_REQUEST_PUT,
+                                    &csPut))
     status = GNUNET_SYSERR;
   if (GNUNET_SYSERR ==
-      capi->cs_handler_register (GNUNET_CS_PROTO_DV_DHT_REQUEST_GET, &csGet))
+      coreAPI->cs_handler_register (GNUNET_CS_PROTO_DV_DHT_REQUEST_GET,
+                                    &csGet))
     status = GNUNET_SYSERR;
   if (GNUNET_SYSERR ==
-      capi->cs_handler_register (GNUNET_CS_PROTO_DV_DHT_REQUEST_GET_END,
-                                 &csGetEnd))
+      coreAPI->cs_handler_register (GNUNET_CS_PROTO_DV_DHT_REQUEST_GET_END,
+                                    &csGetEnd))
     status = GNUNET_SYSERR;
-  if (GNUNET_SYSERR == capi->cs_disconnect_handler_register (&csClientExit))
+  if (GNUNET_SYSERR ==
+      coreAPI->cs_disconnect_handler_register (&csClientExit))
     status = GNUNET_SYSERR;
-  GNUNET_GE_ASSERT (capi->ectx,
-                    0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
-                                                                   capi->ectx,
-                                                                   "ABOUT",
-                                                                   "dht",
-                                                                   gettext_noop
-                                                                   ("Enables 
efficient non-anonymous routing")));
+  GNUNET_GE_ASSERT (coreAPI->ectx,
+                    0 ==
+                    GNUNET_GC_set_configuration_value_string (coreAPI->cfg,
+                                                              coreAPI->ectx,
+                                                              "ABOUT", "dht",
+                                                              gettext_noop
+                                                              ("Enables 
efficient non-anonymous routing")));
   return status;
 }
 
@@ -313,7 +319,7 @@
  * Unregisters handlers, cleans memory structures etc when node exits.
  */
 int
-done_module_dht ()
+done_module_dv_dht ()
 {
   int status;
 

Modified: GNUnet/src/applications/dv_dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/routing.c     2009-06-15 17:42:01 UTC 
(rev 8579)
+++ GNUnet/src/applications/dv_dht/module/routing.c     2009-06-15 17:42:25 UTC 
(rev 8580)
@@ -37,12 +37,8 @@
 #include "gnunet_dv_service.h"
 #include "gnunet_dhtlog_service.h"
 
-#define DEBUG_ROUTING GNUNET_NO
+#define DEBUG_ROUTING GNUNET_YES
 
-#define DHTLOG_GET 1
-#define DHTLOG_PUT 2
-#define GHTLOG_RESULT 3
-
 /**
  * What is the request priority for DV_DHT operations?
  */
@@ -212,11 +208,6 @@
 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
  */
@@ -308,7 +299,6 @@
   GNUNET_CronTime now;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
-  unsigned long long trialuid;
   unsigned long long queryuid;
 #endif
 
@@ -322,6 +312,9 @@
   if (cls != NULL)
     {
       result = cls;
+#if DEBUG_ROUTING
+      result->hop_count = htonl (ntohl (result->hop_count) + 1);
+#endif
     }
   else
     {
@@ -333,19 +326,18 @@
       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,
+          dhtlog->insert_query (&queryuid, 0, DHTLOG_RESULT,
                                 ntohl (result->hop_count), GNUNET_NO,
                                 coreAPI->my_identity, key);
         }
+#if DEBUG_ROUTING
       result->queryuid = htonl (queryuid);
-      result->trialuid = htonl (trialuid);
 #endif
       memcpy (&result[1], data, size);
     }
+
   GNUNET_hash (data, size, &hc);
   routed = 0;
   tracked = 0;
@@ -413,18 +405,16 @@
                              GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                              GNUNET_GE_DEVELOPER,
                              "Routing result to `%s'\n", &enc);
-
+#endif
               if ((debug_routes_extended) && (dhtlog != NULL))
                 {
-                  queryuid = result->queryuid;
-                  trialuid = result->trialuid;
-                  dhtlog->insert_route (NULL, queryuid, trialuid,
+                  queryuid = ntohl (result->queryuid);
+                  dhtlog->insert_route (NULL, queryuid,
                                         DHTLOG_RESULT,
                                         ntohl (result->hop_count), GNUNET_NO,
-                                        coreAPI->my_identity, key, "",
-                                        pos->source);
+                                        coreAPI->my_identity, key, NULL,
+                                        &pos->source);
                 }
-#endif
               dvapi->dv_send (&pos->source,
                               &result->header, DV_DHT_PRIORITY, DV_DHT_DELAY);
 
@@ -480,10 +470,16 @@
 
   hops = ntohl (get->hop_count);
   diameter = GNUNET_DV_DHT_estimate_network_diameter ();
-  if (hops > 2 * diameter)
-    return GNUNET_SYSERR;
+  /*if (hops > 2 * diameter) */
+  if (hops > 8 * diameter)
+    {
+      fprintf (stderr,
+               "hops (%d) > 2 * diameter (%d) so failing (diameter %d)\n",
+               hops, 2 * diameter, diameter);
+      return GNUNET_SYSERR;
+    }
   now = GNUNET_get_time ();
-  expire = now + DV_DHT_DELAY * diameter * 4;
+  expire = now + DV_DHT_DELAY * diameter * 20;
   GNUNET_mutex_lock (lock);
   rt_pos = rt_size;
   for (i = 0; i < rt_size; i++)
@@ -520,6 +516,8 @@
   if (rt_pos == rt_size)
     {
       /* do not route, no slot available */
+      fprintf (stderr, "rt_pos (%d) == rt_size (%d) so failing\n", rt_pos,
+               rt_size);
       GNUNET_mutex_unlock (lock);
       return GNUNET_SYSERR;
     }
@@ -566,7 +564,6 @@
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
   GNUNET_EncName henc;
-  unsigned long long trialuid;
   unsigned long long queryuid;
 #endif
 
@@ -585,6 +582,7 @@
                  "Received DV_DHT GET for key `%s' from `%s'.\n", &enc,
                  sender == NULL ? "me" : (char *) &henc);
 #endif
+
   if (stats != NULL)
     stats->change (stat_get_requests_received, 1);
   if ((sender != NULL) && (GNUNET_OK != add_route (sender, NULL, NULL, get)))
@@ -594,12 +592,12 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Failed to add entry in routing table for request.\n");
+      fprintf (stderr, "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,
+          dhtlog->insert_query (NULL, queryuid, DHTLOG_GET,
                                 hop_count, GNUNET_NO, coreAPI->my_identity,
                                 &get->key);
         }
@@ -650,16 +648,15 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Forwarding DV_DHT GET request to peer `%s'.\n", &enc);
+#endif
       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,
+          dhtlog->insert_route (NULL, ntohl (get->queryuid), 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);
       j++;
     }
@@ -685,7 +682,6 @@
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
   unsigned long long queryuid;
-  unsigned long long trialuid
 #endif
   if (ntohs (msg->size) < sizeof (DV_DHT_MESSAGE))
     {
@@ -702,11 +698,11 @@
                  "Received DV_DHT PUT for key `%s'.\n", &enc);
 #endif
   store = 0;
-  hop_count = htons (put->hop_count);
+  hop_count = htonl (put->hop_count);
   target_value = get_forward_count (hop_count, PUT_TRIES);
   aput = GNUNET_malloc (ntohs (msg->size));
   memcpy (aput, put, ntohs (msg->size));
-  aput->hop_count = htons (hop_count + 1);
+  aput->hop_count = htonl (hop_count + 1);
   aput->network_size =
     htonl (ntohl (put->network_size) +
            GNUNET_DV_DHT_estimate_network_diameter ());
@@ -740,16 +736,15 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Forwarding DV_DHT PUT request to peer `%s'.\n", &enc);
-
+#endif
       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]);
+          dhtlog->insert_route (NULL, queryuid, DHTLOG_PUT,
+                                hop_count, GNUNET_NO,
+                                coreAPI->my_identity, &put->key, sender,
+                                &next[j]);
         }
-#endif
       dvapi->dv_send (&next[j], &aput->header, DV_DHT_PRIORITY, DV_DHT_DELAY);
       j++;
     }
@@ -764,16 +759,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);
+#endif
 
       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);
+          dhtlog->insert_query (NULL, queryuid, DHTLOG_PUT,
+                                hop_count, GNUNET_YES,
+                                coreAPI->my_identity, &put->key);
         }
-#endif
       dstore->put (&put->key,
                    ntohl (put->type),
                    CONTENT_LIFETIME + now,
@@ -787,7 +781,7 @@
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Decided NOT to cache data `%.*s' locally\n",
-                     ntohs (put->header.size) - sizeof (DHT_MESSAGE),
+                     ntohs (put->header.size) - sizeof (DV_DHT_MESSAGE),
                      &put[1]);
 #endif
     }
@@ -804,6 +798,7 @@
   const DV_DHT_MESSAGE *result;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
+  unsigned long long queryuid;
 #endif
 
   if (ntohs (msg->size) < sizeof (DV_DHT_MESSAGE))
@@ -819,15 +814,15 @@
   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))
+#endif
+
+  if ((debug_routes) && (dhtlog != NULL))
     {
-      queryuid = result->queryuid;
-      trialuid = result->trialuid;
-      dhtlog->insert_route (NULL, queryuid, trialuid, DHTLOG_RESULT,
+      queryuid = ntohl (result->queryuid);
+      dhtlog->insert_query (NULL, queryuid, DHTLOG_RESULT,
                             ntohl (result->hop_count), GNUNET_YES,
-                            coreAPI->my_identity, key, sender, "");
+                            coreAPI->my_identity, &result->key);
     }
-#endif
   route_result (&result->key,
                 ntohl (result->type),
                 ntohs (result->header.size) - sizeof (DV_DHT_MESSAGE),
@@ -847,9 +842,7 @@
 #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));
@@ -858,15 +851,13 @@
   get.hop_count = htonl (0);
   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,
+      dhtlog->insert_query (&queryuid, 0, DHTLOG_GET, 0, GNUNET_NO,
                             coreAPI->my_identity, key);
     }
+#if DEBUG_ROUTING
   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,
@@ -948,25 +939,29 @@
   DV_DHT_MESSAGE *put;
 #if DEBUG_ROUTING
   unsigned long long queryuid;
-  unsigned long long trialuid
+  unsigned long long keyuid;
 #endif
-    put = GNUNET_malloc (sizeof (DV_DHT_MESSAGE) + size);
+  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,
+      dhtlog->insert_dhtkey (&keyuid, key);
+      dhtlog->insert_query (&queryuid, 0, DHTLOG_PUT,
                             ntohl (put->hop_count), GNUNET_NO,
                             coreAPI->my_identity, key);
+#if DEBUG_ROUTING
+      fprintf (stderr,
+               "Inserted dhtkey, uid: %llu, inserted query, uid: %llu\n",
+               keyuid, queryuid);
+#endif
     }
+#if DEBUG_ROUTING
   put->queryuid = htonl (queryuid);
-  put->trialuid = htonl (trialuid);
 #endif
   memcpy (&put[1], data, size);
   handle_put (NULL, &put->header);
@@ -1000,7 +995,7 @@
 GNUNET_DV_DHT_init_routing (GNUNET_CoreAPIForPlugins * capi)
 {
   unsigned long long rts;
-
+  unsigned long long nodeuid;
   coreAPI = capi;
   rts = 65536;
   GNUNET_GC_get_configuration_value_number (coreAPI->cfg,
@@ -1032,7 +1027,8 @@
     }
 
   GNUNET_GE_LOG (coreAPI->ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+                 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                 GNUNET_GE_BULK,
                  _("`%s' registering p2p handlers: %d %d %d\n"),
                  "dv_dht", GNUNET_P2P_PROTO_DHT_GET, GNUNET_P2P_PROTO_DHT_PUT,
                  GNUNET_P2P_PROTO_DHT_RESULT);
@@ -1058,13 +1054,40 @@
       debug_routes = GNUNET_YES;
       debug_routes_extended = GNUNET_YES;
     }
+  if (GNUNET_YES == debug_routes_extended)
+    {
+      GNUNET_GE_LOG (coreAPI->ectx,
+                     GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                     GNUNET_GE_BULK,
+                     _("`%s' extended logging enabled\n"), "dv_dht");
+    }
+  else if (GNUNET_YES == debug_routes)
+    {
+      GNUNET_GE_LOG (coreAPI->ectx,
+                     GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                     GNUNET_GE_BULK,
+                     _("`%s' reduced logging enabled\n"), "dv_dht");
+    }
+  else
+    {
+      GNUNET_GE_LOG (coreAPI->ectx,
+                     GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                     GNUNET_GE_BULK, _("`%s' logging disabled\n"), "dv_dht");
 
+    }
+
   if (GNUNET_YES == GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
                                                              "DHT",
                                                              "DHTLOG_MYSQL",
                                                              GNUNET_NO))
     {
+      GNUNET_GE_LOG (coreAPI->ectx,
+                     GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+                     GNUNET_GE_BULK,
+                     _("`%s' loading logging context %s\n"),
+                     "dv_dht", "dhtlog_mysql");
       dhtlog = coreAPI->service_request ("dhtlog_mysql");
+      dhtlog->insert_node (&nodeuid, coreAPI->my_identity);
       GNUNET_GE_ASSERT (coreAPI->ectx, dhtlog != NULL);
     }
 
@@ -1101,6 +1124,12 @@
       coreAPI->service_release (dhtlog);
       dhtlog = NULL;
     }
+
+  if (dvapi != NULL)
+    {
+      coreAPI->service_release (dvapi);
+      dvapi = NULL;
+    }
   GNUNET_mutex_destroy (lock);
   for (i = 0; i < rt_size; i++)
     {

Modified: GNUnet/src/applications/dv_dht/module/service.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/service.c     2009-06-15 17:42:01 UTC 
(rev 8579)
+++ GNUnet/src/applications/dv_dht/module/service.c     2009-06-15 17:42:25 UTC 
(rev 8580)
@@ -93,7 +93,6 @@
 provide_module_dv_dht (GNUNET_CoreAPIForPlugins * capi)
 {
   static GNUNET_DV_DHT_ServiceAPI api;
-
   if (GNUNET_OK != GNUNET_DV_DHT_table_init (capi))
     {
       GNUNET_GE_BREAK (capi->ectx, 0);

Modified: GNUnet/src/applications/dv_dht/module/table.c
===================================================================
--- GNUnet/src/applications/dv_dht/module/table.c       2009-06-15 17:42:01 UTC 
(rev 8579)
+++ GNUnet/src/applications/dv_dht/module/table.c       2009-06-15 17:42:25 UTC 
(rev 8580)
@@ -67,12 +67,13 @@
  * What is the chance (1 in XXX) that we send DISCOVERY messages
  * to another peer?
  */
-#define MAINTAIN_CHANCE (10 + 100 * total_peers)
+/*#define MAINTAIN_CHANCE (10 + 100 * total_peers)*/
+#define MAINTAIN_CHANCE (1 + total_peers)
 
 /**
  * How long can a peer be inactive before we time it out?
  */
-#define MAINTAIN_PEER_TIMEOUT MAINTAIN_FREQUENCY * MAINTAIN_CHANCE * 4
+#define MAINTAIN_PEER_TIMEOUT MAINTAIN_FREQUENCY * MAINTAIN_CHANCE * 4 + 100
 
 /**
  * What is the maximum number of known DV_DHT-enabled peers
@@ -495,8 +496,7 @@
     {
       dvapi->dv_send (other,
                       &disco->header,
-                      GNUNET_EXTREME_PRIORITY / 4,
-                      MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
+                      GNUNET_EXTREME_PRIORITY / 4, 2 * GNUNET_CRON_SECONDS);
       return;
     }
   pc = total_peers;
@@ -528,8 +528,9 @@
     }
   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);
+  //fprintf(stderr, "Sending discovery message, number of known peers %d\n", 
total_peers);
+  dvapi->dv_send (other, &disco->header, GNUNET_EXTREME_PRIORITY / 4,
+                  2 * GNUNET_CRON_SECONDS);
   GNUNET_free (disco);
 }
 
@@ -538,6 +539,7 @@
 {
   if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, MAINTAIN_CHANCE) != 0)
     return;
+  //fprintf(stderr, "sending discovery message\n");
   broadcast_dht_discovery (other, cls);
 }
 
@@ -548,7 +550,6 @@
 maintain_dht_job (void *unused)
 {
   P2P_DV_DHT_Discovery disc;
-
   if (total_peers == 0)
     {
       disc.header.size = htons (sizeof (P2P_DV_DHT_Discovery));
@@ -667,7 +668,9 @@
   if (bucket->peers_size >= MAINTAIN_BUCKET_SIZE)
     return;                     /* do not care */
   if (NULL != findPeerEntryInBucket (bucket, peer))
-    return;                     /* already have this peer in buckets */
+    {
+      return;                   /* already have this peer in buckets */
+    }
   /* do we know how to contact this peer? */
   hello =
     identity->identity2Hello (peer, GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY,
@@ -683,9 +686,11 @@
                       5 * GNUNET_CRON_SECONDS);
       return;
     }
+
   GNUNET_free (hello);
   /* check if connected, if not, send discovery */
-  if (GNUNET_OK != coreAPI->p2p_connection_status_check (peer, NULL, NULL))
+  /* coreAPI->p2p_connection_status_check (peer, NULL, NULL); */
+  if (GNUNET_OK != dvapi->p2p_connection_status_check (peer, NULL, NULL))
     {
       /* not yet connected; connect sending DISCOVERY */
       broadcast_dht_discovery (peer, NULL);
@@ -771,7 +776,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, 1 * GNUNET_CRON_SECONDS);
   GNUNET_free (hello);
   return GNUNET_OK;
 }
@@ -875,6 +880,10 @@
       coreAPI->service_release (stats);
       stats = NULL;
     }
+  if (dvapi != NULL)
+    {
+      coreAPI->service_release (dvapi);
+    }
   coreAPI->service_release (identity);
   identity = NULL;
   coreAPI->service_release (pingpong);

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c       
2009-06-15 17:42:01 UTC (rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_expiration_test.c       
2009-06-15 17:42:25 UTC (rev 8580)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file applications/dht/tools/dht_expiration_test.c
+ * @file applications/dv_dht/tools/dv_dht_expiration_test.c
  * @brief DV_DHT testcase using only a single peer
  * @author Christian Grothoff
  * @author Nathan Evans

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c       
2009-06-15 17:42:01 UTC (rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_forwarding_test.c       
2009-06-15 17:42:25 UTC (rev 8580)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file applications/dht/tools/dht_multipeer_test.c
+ * @file applications/dv_dht/tools/dv_dht_multipeer_test.c
  * @brief DV_DHT testcase
  * @author Christian Grothoff
  * @author Nathan Evans

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-06-15 17:42:01 UTC (rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_multi_topology_test.c   
2009-06-15 17:42:25 UTC (rev 8580)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file applications/dht/tools/dht_multipeer_test.c
+ * @file applications/dv_dht/tools/dv_dht_multipeer_test.c
  * @brief DV_DHT testcase
  * @author Christian Grothoff
  * @author Nathan Evans
@@ -37,7 +37,7 @@
  * How many peers should the testcase run?  Note that
  * we create a clique topology so the cost is quadratic!
  */
-#define NUM_PEERS 8
+#define NUM_PEERS 15
 
 /**
  * How many times will we try the DV_DHT-GET operation before
@@ -48,7 +48,7 @@
 /**
  * How often do we iterate the put-get loop?
  */
-#define NUM_REPEAT 5
+#define NUM_REPEAT 50
 
 static int ok;
 static int found;
@@ -86,6 +86,22 @@
   return GNUNET_OK;
 }
 
+static int
+getPeers (const char *name, unsigned long long value, void *cls)
+{
+  if ((value > 0) && (strstr (name, _("# dv")) != NULL))
+    {
+      fprintf (stderr, "%s : %llu\n", name, value);
+    }
+
+  if ((value > 0) && (0 == strcmp (_("# dv_dht connections"), name)))
+    {
+      ok = 1;
+      return GNUNET_SYSERR;
+    }
+  return GNUNET_OK;
+}
+
 #define CHECK(a) do { if (!(a)) { ret = 1; GNUNET_GE_BREAK(ectx, 0); goto 
FAILURE; } } while(0)
 
 /**
@@ -138,10 +154,38 @@
       peer_array[i] = pos;
       pos = pos->next;
     }
-
+  sleep (30);
   found = 0;
   for (r = 0; r < NUM_REPEAT; r++)
     {
+      fprintf (stderr, "After %d minutes\n", r);
+      for (i = 0; i < NUM_PEERS; i++)
+        {
+          if (GNUNET_shutdown_test () == GNUNET_YES)
+            break;
+          fprintf (stderr, "Peer %d: ", i);
+          sock =
+            GNUNET_client_connection_create (NULL, peer_array[i]->config);
+          GNUNET_STATS_get_statistics (NULL, sock, &getPeers, NULL);
+          GNUNET_thread_sleep (2 * GNUNET_CRON_SECONDS);
+          GNUNET_client_connection_destroy (sock);
+
+        }
+      if (GNUNET_shutdown_test () == GNUNET_YES)
+        break;
+      sleep (60);
+    }
+  pos = peers;
+  while (pos != NULL)
+    {
+      GNUNET_REMOTE_kill_daemon (pos);
+      pos = pos->next;
+    }
+  GNUNET_GC_free (cfg);
+  return ret;
+
+  for (r = 0; r < NUM_REPEAT; r++)
+    {
       if (r > 0)
         {
           printf ("Found %u out of %u attempts.\n", found,

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c        
2009-06-15 17:42:01 UTC (rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_multipeer_test.c        
2009-06-15 17:42:25 UTC (rev 8580)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file applications/dht/tools/dht_multipeer_test.c
+ * @file applications/dv_dht/tools/dv_dht_multipeer_test.c
  * @brief DV_DHT testcase
  * @author Christian Grothoff
  * @author Nathan Evans
@@ -121,7 +121,7 @@
     }
   printf ("Starting %u peers...\n", NUM_PEERS);
   peers = GNUNET_TESTING_start_daemons ("tcp",
-                                        "advertising dv dv_dht stats",
+                                        "advertising dv_dht stats",
                                         "/tmp/gnunet-dv-dht-multi-test",
                                         2087, 10, NUM_PEERS);
   if (peers == NULL)

Modified: GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c  2009-06-15 
17:42:01 UTC (rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/dv_dht_twopeer_test.c  2009-06-15 
17:42:25 UTC (rev 8580)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file applications/dht/tools/dht_twopeer_test.c
+ * @file applications/dv_dht/tools/dv_dht_twopeer_test.c
  * @brief DV_DHT testcase
  * @author Christian Grothoff
  * @author Nathan Evans
@@ -182,7 +182,7 @@
 #if START_PEERS
   fprintf (stderr, "Starting peers...\n");
   peers = GNUNET_TESTING_start_daemons ("tcp",
-                                        "advertising dv dv_dht stats",
+                                        "advertising dv_dht stats",
                                         "/tmp/gnunet-dv-dht-two-test",
                                         22087, 10, 2);
   CHECK (peers != NULL);

Modified: GNUnet/src/applications/dv_dht/tools/dv_test.conf
===================================================================
--- GNUnet/src/applications/dv_dht/tools/dv_test.conf   2009-06-15 17:42:01 UTC 
(rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/dv_test.conf   2009-06-15 17:42:25 UTC 
(rev 8580)
@@ -1,7 +1,8 @@
 [MULTIPLE_SERVER_TESTING]
-CONTROL_HOST=127.0.0.0/8;
+CONTROL_HOST=127.0.0.1;
 HOSTNAMES=localhost
 STARTING_PORT=31387
 PORT_INCREMENT=2
 BASE_CONFIG=gnunetd_dv.conf
-TOPOLOGY=2
+TOPOLOGY=0
+#PERCENTAGE=.45

Modified: GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf
===================================================================
--- GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf        2009-06-15 
17:42:01 UTC (rev 8579)
+++ GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf        2009-06-15 
17:42:25 UTC (rev 8580)
@@ -6,8 +6,8 @@
 GNUNETD_HOME =
 
 [GNUNETD]
-APPLICATIONS = advertising getoption stats tracekit dv_tbench dv_dht
-TRANSPORTS = udp tcp nat
+APPLICATIONS = advertising getoption topology_default stats dv_dht
+TRANSPORTS = udp tcp
 HOSTS = $GNUNETD_HOME/data/hosts/
 HTTP-PROXY = 
 FDLIMIT = 1024
@@ -31,7 +31,7 @@
 DISABLE-ADVERTISEMENTS = NO
 HELLOEXCHANGE = YES
 DISABLE-AUTOCONNECT = NO
-INTERFACE = eth1
+INTERFACE = eth0
 
 [F2F]
 FRIENDS-ONLY = YES
@@ -84,6 +84,8 @@
 
 [DHT]
 TABLESIZE = 1024
+LOGSQLEXTENDED = YES
+DHTLOG_MYSQL = YES
 
 [DSTORE]
 QUOTA = 1





reply via email to

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