gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12409 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r12409 - gnunet/src/dht
Date: Fri, 30 Jul 2010 16:41:29 +0200

Author: nevans
Date: 2010-07-30 16:41:29 +0200 (Fri, 30 Jul 2010)
New Revision: 12409

Modified:
   gnunet/src/dht/Makefile.am
   gnunet/src/dht/dht_api.c
   gnunet/src/dht/dhtlog.c
   gnunet/src/dht/gnunet-dht-driver.c
   gnunet/src/dht/gnunet-service-dht.c
   gnunet/src/dht/plugin_dhtlog_mysql_dump.c
   gnunet/src/dht/test_dht_multipeer_data.conf
   gnunet/src/dht/test_dhtlog_data.conf
Log:
some dht changes

Modified: gnunet/src/dht/Makefile.am
===================================================================
--- gnunet/src/dht/Makefile.am  2010-07-30 13:40:40 UTC (rev 12408)
+++ gnunet/src/dht/Makefile.am  2010-07-30 14:41:29 UTC (rev 12409)
@@ -22,8 +22,19 @@
  libgnunetdhtlog.la
 
 plugin_LTLIBRARIES = \
- libgnunet_plugin_dhtlog_dummy.la $(MYSQL_PLUGIN)
+ libgnunet_plugin_dhtlog_dummy.la $(MYSQL_PLUGIN) \
+ libgnunet_plugin_dhtlog_mysql_dump.la 
 
+if HAVE_MYSQL
+libgnunet_plugin_dhtlog_mysql_la_SOURCES = \
+  plugin_dhtlog_mysql.c
+libgnunet_plugin_dhtlog_mysql_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(XLIB)
+libgnunet_plugin_dhtlog_mysql_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS) $(MYSQL_LDFLAGS) -lmysqlclient $(ZLIB_LNK)
+endif 
+
 libgnunet_plugin_dhtlog_dummy_la_SOURCES = \
   plugin_dhtlog_dummy.c
 libgnunet_plugin_dhtlog_dummy_la_LIBADD = \
@@ -31,6 +42,14 @@
   $(XLIB)
 libgnunet_plugin_dhtlog_dummy_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
+ 
+libgnunet_plugin_dhtlog_mysql_dump_la_SOURCES = \
+  plugin_dhtlog_mysql_dump.c
+libgnunet_plugin_dhtlog_mysql_dump_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(XLIB)
+libgnunet_plugin_dhtlog_mysql_dump_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
 
 libgnunetdhtlog_la_SOURCES = \
   dhtlog.c dhtlog.h
@@ -40,18 +59,6 @@
   $(GN_LIB_LDFLAGS) $(WINFLAGS) \
   -version-info 0:0:0
 
-if HAVE_MYSQL
-libgnunet_plugin_dhtlog_mysql_la_SOURCES = \
-  plugin_dhtlog_mysql.c
-libgnunet_plugin_dhtlog_mysql_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(XLIB)
-libgnunet_plugin_dhtlog_mysql_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS) $(MYSQL_LDFLAGS) -lmysqlclient $(ZLIB_LNK)
-libgnunet_plugin_dhtlog_mysql_la_CPPFLAGS = \
- $(MYSQL_CPPFLAGS) 
-endif 
-
 libgnunetdht_la_SOURCES = \
   dht_api.c dht.h
 libgnunetdht_la_LIBADD = \
@@ -75,7 +82,7 @@
  gnunet-dht-put 
 
 noinst_PROGRAMS = \
- gnunet-dht-driver
+ gnunet-dht-driver ${check_PROGRAMS}
 
 gnunet_service_dht_SOURCES = \
  gnunet-service-dht.c         

Modified: gnunet/src/dht/dht_api.c
===================================================================
--- gnunet/src/dht/dht_api.c    2010-07-30 13:40:40 UTC (rev 12408)
+++ gnunet/src/dht/dht_api.c    2010-07-30 14:41:29 UTC (rev 12409)
@@ -365,6 +365,7 @@
                                            
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     }
 
+  GNUNET_assert(handle->th == NULL);
   if (pos->unique_id == 0)
     GNUNET_free(pos->msg);
   GNUNET_free (pos);
@@ -570,6 +571,7 @@
                                               handle->cfg);
       if (handle->current != NULL)
         {
+          handle->th = NULL;
           finish(handle, GNUNET_SYSERR); /* If there was a current message, 
kill it! */
         }
 #if RETRANSMIT
@@ -686,7 +688,7 @@
               "`%s': Called GNUNET_DHT_disconnect\n", "DHT API");
 #endif
   GNUNET_assert (handle != NULL);
-  if (handle->th != NULL)       /* We have a live transmit request in the 
Aether */
+  if (handle->th != NULL)       /* We have a live transmit request */
     {
       GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th);
       handle->th = NULL;
@@ -1176,6 +1178,7 @@
 
   if ((handle->current != NULL) && (handle->retransmit_stage != 
DHT_RETRANSMITTING))
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "handle->current is not null!\n");
       if (cont != NULL)
         {
           GNUNET_SCHEDULER_add_continuation (handle->sched, cont, cont_cls,
@@ -1204,6 +1207,7 @@
 
   if (put_route == NULL) /* Route start failed! */
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "route start for PUT failed!\n");
       if (cont != NULL)
         {
           GNUNET_SCHEDULER_add_continuation (handle->sched, cont, cont_cls,

Modified: gnunet/src/dht/dhtlog.c
===================================================================
--- gnunet/src/dht/dhtlog.c     2010-07-30 13:40:40 UTC (rev 12408)
+++ gnunet/src/dht/dhtlog.c     2010-07-30 14:41:29 UTC (rev 12409)
@@ -65,6 +65,7 @@
                   _("Failed to load dhtlog plugin for `%s'\n"), plugin_name);
       GNUNET_free (plugin_name);
       GNUNET_free (plugin);
+      return NULL;
     }
 
   api = plugin->dhtlog_api;

Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c  2010-07-30 13:40:40 UTC (rev 12408)
+++ gnunet/src/dht/gnunet-dht-driver.c  2010-07-30 14:41:29 UTC (rev 12409)
@@ -22,12 +22,7 @@
  * @brief Driver for setting up a group of gnunet peers and
  *        then issuing GETS and PUTS on the DHT.  Coarse results
  *        are reported, fine grained results (if requested) are
- *        logged to a (mysql) database.
- *
- *  TODO: Add multiple database support; alternatively, dump
- *        sql readable (or easily transformed) logs to disk
- *        for reassembly later.  This could remove the mysql
- *        server as a bottleneck during testing.
+ *        logged to a (mysql) database, or to file.
  */
 #include "platform.h"
 #include "gnunet_testing_lib.h"
@@ -36,7 +31,7 @@
 #include "dhtlog.h"
 
 /* DEFINES */
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 /* Timeout for entire driver to run */
 #define DEFAULT_TIMEOUT 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
@@ -405,6 +400,7 @@
 static void
 finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
 {
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ending test normally!\n", (char 
*)cls);
   GNUNET_assert (pg != NULL);
   struct TestPutContext *test_put = all_puts;
   struct TestGetContext *test_get = all_gets;
@@ -433,17 +429,20 @@
 
   /* FIXME: optionally get stats for dropped messages, etc. */
   if (dhtlog_handle != NULL)
-    dhtlog_handle->update_trial (trialuid, 0, 0, 0);
+    {
+      fprintf(stderr, "Update trial endtime\n");
+      dhtlog_handle->update_trial (trialuid, 0, 0, 0);
+    }
 
   if (hostkey_meter != NULL)
     free_meter(hostkey_meter);
-  if (hostkey_meter != NULL)
+  if (peer_start_meter != NULL)
     free_meter(peer_start_meter);
-  if (hostkey_meter != NULL)
+  if (peer_connect_meter != NULL)
     free_meter(peer_connect_meter);
-  if (hostkey_meter != NULL)
+  if (put_meter != NULL)
     free_meter(put_meter);
-  if (hostkey_meter != NULL)
+  if (get_meter != NULL)
     free_meter(get_meter);
 
   ok = 0;
@@ -458,7 +457,7 @@
 static void
 end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failing test with error: `%s'!\n", 
(char *)cls);
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failing test with error: `%s'!\n", 
(char *)cls);
 
   struct TestPutContext *test_put = all_puts;
   struct TestGetContext *test_get = all_gets;
@@ -485,15 +484,22 @@
 
   GNUNET_TESTING_daemons_stop (pg, DEFAULT_TIMEOUT, &shutdown_callback, NULL);
 
+  /* FIXME: optionally get stats for dropped messages, etc. */
+  if (dhtlog_handle != NULL)
+    {
+      fprintf(stderr, "Update trial endtime\n");
+      dhtlog_handle->update_trial (trialuid, 0, 0, 0);
+    }
+
   if (hostkey_meter != NULL)
     free_meter(hostkey_meter);
-  if (hostkey_meter != NULL)
+  if (peer_start_meter != NULL)
     free_meter(peer_start_meter);
-  if (hostkey_meter != NULL)
+  if (peer_connect_meter != NULL)
     free_meter(peer_connect_meter);
-  if (hostkey_meter != NULL)
+  if (put_meter != NULL)
     free_meter(put_meter);
-  if (hostkey_meter != NULL)
+  if (get_meter != NULL)
     free_meter(get_meter);
 
   ok = 1;
@@ -613,6 +619,7 @@
     }
   if (test_get == NULL)
     return; /* End of the list */
+
   memset(data, test_get->uid, sizeof(data));
   GNUNET_CRYPTO_hash(data, test_data_size, &key);
 
@@ -654,6 +661,9 @@
   outstanding_puts--;
   puts_completed++;
 
+  if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
+    fprintf(stderr, "PUT Request failed!\n");
+
   GNUNET_SCHEDULER_cancel(sched, test_put->disconnect_task);
   test_put->disconnect_task = GNUNET_SCHEDULER_add_now(sched, 
&put_disconnect_task, test_put);
   if (GNUNET_YES == update_meter(put_meter))
@@ -662,7 +672,7 @@
       GNUNET_SCHEDULER_cancel (sched, die_task);
       die_task = GNUNET_SCHEDULER_add_delayed (sched, all_get_timeout,
                                                &end_badly, "from do gets");
-      GNUNET_SCHEDULER_add_delayed(sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 100), &do_get, 
all_gets);
+      GNUNET_SCHEDULER_add_delayed(sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time), &do_get, 
all_gets);
       return;
     }
 }
@@ -749,7 +759,7 @@
       all_gets = test_get;
     }
 
-  GNUNET_SCHEDULER_cancel (sched, die_task);
+  /*GNUNET_SCHEDULER_cancel (sched, die_task);*/
   die_task = GNUNET_SCHEDULER_add_delayed (sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, num_puts * 2),
                                            &end_badly, "from do puts");
   GNUNET_SCHEDULER_add_now (sched, &do_put, all_puts);
@@ -805,8 +815,8 @@
         dhtlog_handle->update_connections (trialuid, total_connections);
 
       GNUNET_SCHEDULER_cancel (sched, die_task);
-      die_task = GNUNET_SCHEDULER_add_delayed (sched, DEFAULT_TIMEOUT,
-                                               &end_badly, "from setup 
puts/gets");
+      /*die_task = GNUNET_SCHEDULER_add_delayed (sched, DEFAULT_TIMEOUT,
+                                               &end_badly, "from setup 
puts/gets");*/
 
       GNUNET_SCHEDULER_add_delayed (sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time), 
&setup_puts_and_gets, NULL);
     }
@@ -947,6 +957,8 @@
      char *const *args,
      const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
+  struct GNUNET_TESTING_Host *hosts;
+  struct GNUNET_TESTING_Host *temphost;
   char * topology_str;
   char * connect_topology_str;
   char * blacklist_topology_str;
@@ -956,9 +968,15 @@
   char * topology_percentage_str;
   float topology_percentage;
   char * topology_probability_str;
+  char * hostfile;
   float topology_probability;
   unsigned long long temp_config_number;
+  char *buf;
+  char *data;
 
+  struct stat frstat;
+  int count;
+
   sched = s;
 
   /* Get path from configuration file */
@@ -986,10 +1004,62 @@
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (cfg, "dht_testing", "comment",
-                                                 &trialmessage))
+                                             &trialmessage))
     trialmessage = NULL;
 
   if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hostfile",
+                                             &hostfile))
+    hostfile = NULL;
+
+  hosts = NULL;
+  if (hostfile != NULL)
+    {
+      if (GNUNET_OK != GNUNET_DISK_file_test (hostfile))
+          GNUNET_DISK_fn_write (hostfile, NULL, 0, GNUNET_DISK_PERM_USER_READ
+            | GNUNET_DISK_PERM_USER_WRITE);
+      if ((0 != STAT (hostfile, &frstat)) || (frstat.st_size == 0))
+        {
+          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                      "Could not open file specified for host list, ending 
test!");
+          ok = 1119;
+          GNUNET_free_non_null(trialmessage);
+          GNUNET_free(hostfile);
+          return;
+        }
+
+    data = GNUNET_malloc_large (frstat.st_size);
+    GNUNET_assert(data != NULL);
+    if (frstat.st_size !=
+        GNUNET_DISK_fn_read (hostfile, data, frstat.st_size))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Could not read file %s specified for host list, ending 
test!", hostfile);
+        GNUNET_free (hostfile);
+        GNUNET_free (data);
+        return;
+      }
+
+    buf = data;
+    count = 0;
+    while (count < frstat.st_size)
+      {
+        count++;
+        if (((data[count] == '\n') || (data[count] == '\0')) && (buf != 
&data[count]))
+          {
+            data[count] = '\0';
+            temphost = GNUNET_malloc(sizeof(struct GNUNET_TESTING_Host));
+            temphost->hostname = buf;
+            temphost->next = hosts;
+            hosts = temphost;
+            buf = &data[count + 1];
+          }
+        else if ((data[count] == '\n') || (data[count] == '\0'))
+          buf = &data[count + 1];
+      }
+    }
+
+  if (GNUNET_OK !=
           GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 
"malicious_getters",
                                                  &malicious_getters))
     malicious_getters = 0;
@@ -1199,7 +1269,7 @@
   hostkey_meter = create_meter(peers_left, "Hostkeys created ", GNUNET_YES);
   peer_start_meter = create_meter(peers_left, "Peers started ", GNUNET_YES);
 
-  put_meter = create_meter(num_gets, "Puts completed ", GNUNET_YES);
+  put_meter = create_meter(num_puts, "Puts completed ", GNUNET_YES);
   get_meter = create_meter(num_gets, "Gets completed ", GNUNET_YES);
   pg = GNUNET_TESTING_daemons_start (sched, cfg,
                                      peers_left,
@@ -1207,7 +1277,7 @@
                                      &hostkey_callback, NULL,
                                      &peers_started_callback, NULL,
                                      &topology_callback, NULL,
-                                     NULL);
+                                     hosts);
 
 }
 

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-07-30 13:40:40 UTC (rev 12408)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-07-30 14:41:29 UTC (rev 12409)
@@ -58,6 +58,12 @@
  */
 #define MINIMUM_PEER_THRESHOLD 20
 
+#define DHT_DEFAULT_FIND_PEER_REPLICATION 20
+
+#define DHT_DEFAULT_FIND_PEER_OPTIONS GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE
+
+#define DHT_DEFAULT_FIND_PEER_INTERVAL 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
+
 /**
  * Real maximum number of hops, at which point we refuse
  * to forward the message.
@@ -1064,6 +1070,8 @@
 }
 
 
+
+
 /**
  * Called when a reply needs to be sent to a client, as
  * a result it found to a GET or FIND PEER request.
@@ -1120,7 +1128,35 @@
   struct DHTQueryRecord *record;
   struct DHTRouteSource *pos;
   struct PeerInfo *peer_info;
+  struct GNUNET_MessageHeader *hello_msg;
 
+  /**
+   * If a find peer result message is received and contains a valid
+   * HELLO for another peer, offer it to the transport service.
+   *
+   * FIXME: Check whether we need this peer (based on routing table
+   * fullness) and only try to connect to it conditionally.  This should
+   * reduce trying to connect to say (500) peers when the bucket size will
+   * discard most of them.
+   */
+  if (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT)
+    {
+      if (ntohs(msg->size) <= sizeof(struct GNUNET_MessageHeader))
+        GNUNET_break_op(0);
+
+      hello_msg = &msg[1];
+      if (ntohs(hello_msg->type) != GNUNET_MESSAGE_TYPE_HELLO)
+      {
+        GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Received non-HELLO 
message type in find peer result message!\n", my_short_id, "DHT");
+        GNUNET_break_op(0);
+      }
+      else
+      {
+        GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Received HELLO message 
for another peer, offering to transport!\n", my_short_id, "DHT");
+        GNUNET_TRANSPORT_offer_hello(transport_handle, hello_msg);
+      }
+
+    }
   record = GNUNET_CONTAINER_multihashmap_get(forward_list.hashmap, 
message_context->key);
   if (record == NULL) /* No record of this message! */
     {
@@ -1131,13 +1167,6 @@
 #endif
 #if DEBUG_DHT_ROUTING
 
-      /*if ((debug_routes) && (dhtlog_handle != NULL))
-        {
-          dhtlog_handle->insert_query (NULL, message_context->unique_id, 
DHTLOG_RESULT,
-                                       message_context->hop_count, 
GNUNET_SYSERR,
-                                       &my_identity, message_context->key);
-        }*/
-
       if ((debug_routes_extended) && (dhtlog_handle != NULL))
         {
           dhtlog_handle->insert_route (NULL,
@@ -1161,7 +1190,7 @@
   pos = record->head;
   while (pos != NULL)
     {
-      if (0 == memcmp(&pos->source, &my_identity, sizeof(struct 
GNUNET_PeerIdentity))) /* Local client initiated request! */
+      if (0 == memcmp(&pos->source, &my_identity, sizeof(struct 
GNUNET_PeerIdentity))) /* Local client (or DHT) initiated request! */
         {
 #if DEBUG_DHT
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1169,14 +1198,6 @@
                       "DHT", GNUNET_h2s (message_context->key), 
message_context->unique_id);
 #endif
 #if DEBUG_DHT_ROUTING
-          /*
-          if ((debug_routes) && (dhtlog_handle != NULL))
-            {
-              dhtlog_handle->insert_query (NULL, message_context->unique_id, 
DHTLOG_RESULT,
-                                           message_context->hop_count, 
GNUNET_YES,
-                                           &my_identity, message_context->key);
-            }*/
-
           if ((debug_routes_extended) && (dhtlog_handle != NULL))
             {
               dhtlog_handle->insert_route (NULL, message_context->unique_id, 
DHTLOG_RESULT,
@@ -1406,16 +1427,16 @@
       GNUNET_break_op (0);
       return;
     }
+
   find_peer_result = GNUNET_malloc (tsize);
   find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT);
   find_peer_result->size = htons (tsize);
   memcpy (&find_peer_result[1], my_hello, hello_size);
-#if DEBUG_DHT_HELLO
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "`%s': Sending hello size %d to client.\n",
-                "DHT", hello_size);
-#endif
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "`%s': Sending hello size %d to requesting peer.\n",
+              "DHT", hello_size);
+
   new_msg_ctx = GNUNET_malloc(sizeof(struct DHT_MessageContext));
   memcpy(new_msg_ctx, message_context, sizeof(struct DHT_MessageContext));
   new_msg_ctx->peer = &my_identity;
@@ -1996,10 +2017,13 @@
           }
 #endif
       break;
-    case GNUNET_MESSAGE_TYPE_DHT_FIND_PEER: /* Check if closest, check 
options, add to requests seen */
-      cache_response (cls, message_context);
-      if ((message_context->closest == GNUNET_YES) || 
(message_context->msg_options == GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE))
-        handle_dht_find_peer (cls, msg, message_context);
+    case GNUNET_MESSAGE_TYPE_DHT_FIND_PEER: /* Check if closest and not 
started by us, check options, add to requests seen */
+      if (0 != memcmp(message_context->peer, &my_identity, sizeof(struct 
GNUNET_PeerIdentity)))
+      {
+        cache_response (cls, message_context);
+        if ((message_context->closest == GNUNET_YES) || 
(message_context->msg_options == GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE))
+          handle_dht_find_peer (cls, msg, message_context);
+      }
       break;
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -2082,6 +2106,45 @@
 }
 
 /**
+ * Task to send a find peer message for our own peer identifier
+ * so that we can find the closest peers in the network to ourselves
+ * and attempt to connect to them.
+ *
+ * @param cls closure for this task
+ * @param tc the context under which the task is running
+ */
+static void
+send_find_peer_message (void *cls, const struct GNUNET_SCHEDULER_TaskContext 
*tc)
+{
+  struct GNUNET_MessageHeader *find_peer_msg;
+  struct DHT_MessageContext message_context;
+  int ret;
+
+  if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
+    return;
+
+  find_peer_msg = GNUNET_malloc(sizeof(struct GNUNET_MessageHeader));
+  find_peer_msg->size = htons(sizeof(struct GNUNET_MessageHeader));
+  find_peer_msg->type = htons(GNUNET_MESSAGE_TYPE_DHT_FIND_PEER);
+  memset(&message_context, 0, sizeof(struct DHT_MessageContext));
+  message_context.key = &my_identity.hashPubKey;
+  message_context.unique_id = GNUNET_ntohll 
(GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t)-1));
+  message_context.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
+  message_context.msg_options = ntohl (DHT_DEFAULT_FIND_PEER_OPTIONS);
+  message_context.network_size = estimate_diameter();
+  message_context.peer = &my_identity;
+
+  ret = route_message(NULL, find_peer_msg, &message_context);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "`%s:%s': Sent `%s' request to %d peers\n", my_short_id, "DHT",
+              "FIND PEER", ret);
+  GNUNET_SCHEDULER_add_delayed (sched,
+                                DHT_DEFAULT_FIND_PEER_INTERVAL,
+                                &send_find_peer_message, NULL);
+}
+
+/**
  * Handler for any generic DHT messages, calls the appropriate handler
  * depending on message type, sends confirmation if responses aren't otherwise
  * expected.
@@ -2491,10 +2554,13 @@
         {
           GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                       "Could not connect to mysql logging server, logging will 
not happen!");
-          return;
         }
     }
 
+  GNUNET_SCHEDULER_add_delayed (sched,
+                                
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30),
+                                &send_find_peer_message, NULL);
+
   cleanup_task = GNUNET_SCHEDULER_add_delayed (sched,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
                                                &shutdown_task, NULL);

Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump.c   2010-07-30 13:40:40 UTC (rev 
12408)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump.c   2010-07-30 14:41:29 UTC (rev 
12409)
@@ -122,6 +122,7 @@
       return GNUNET_SYSERR;
     }
 #undef PINIT
+
   return GNUNET_OK;
 }
 
@@ -160,7 +161,8 @@
            int malicious_droppers, char *message)
 {
   int ret;
-  *trialuid = 0;
+  if (trialuid != NULL)
+    *trialuid = 0;
   if (outfile == NULL)
     return GNUNET_SYSERR;
 
@@ -180,11 +182,11 @@
   if (ret < 0)
     return GNUNET_SYSERR;
   ret = fprintf(outfile, "execute insert_trial using "
-                         "@num, @topology, @bl, "
-                         "@connect, @c_t_o, @c_t_o_m, @t_p, "
-                         "@t_pr, @puts, @gets, "
-                         "@concurrent, @settle, @rounds, "
-                         "@m_gets, @m_puts, @m_drops, "
+                         "@num, @topology, @t_p, @t_pr,"
+                         " @bl, @connect, @c_t_o,"
+                         "@c_t_o_m, @puts, @gets,"
+                         "@concurrent, @settle, @rounds,"
+                         "@m_gets, @m_puts, @m_drops,"
                          "@message;\n");
 
   ret = fprintf(outfile, "execute select_trial;\n");
@@ -208,7 +210,8 @@
 add_dhtkey (unsigned long long *dhtkeyuid, const GNUNET_HashCode * dhtkey)
 {
   int ret;
-  *dhtkeyuid = 0;
+  if (dhtkeyuid != NULL)
+    *dhtkeyuid = 0;
 
   if (outfile == NULL)
     return GNUNET_SYSERR;
@@ -330,7 +333,7 @@
   if (ret < 0)
     return GNUNET_SYSERR;
 
-  ret = fprintf(outfile, "execute update_connections using @conns;\n");
+  ret = fprintf(outfile, "execute update_conn using @conns;\n");
 
   if (ret >= 0)
     return GNUNET_OK;
@@ -361,7 +364,8 @@
   if (outfile == NULL)
     return GNUNET_SYSERR;
 
-  *sqlqueryuid = 0;
+  if (sqlqueryuid != NULL)
+    *sqlqueryuid = 0;
 
   if (key != NULL)
     ret = fprintf(outfile, "select dhtkeyuid from dhtkeys where trialuid = 
@temp_trial and dhtkey = \"%s\" into @temp_dhtkey;\n", GNUNET_h2s_full(key));
@@ -413,7 +417,8 @@
   if (outfile == NULL)
     return GNUNET_SYSERR;
 
-  *sqlqueryuid = 0;
+  if (sqlqueryuid != NULL)
+    *sqlqueryuid = 0;
 
   if (key != NULL)
     ret = fprintf(outfile, "select dhtkeyuid from dhtkeys where trialuid = 
@temp_trial and dhtkey = \"%s\" into @temp_dhtkey;\n", GNUNET_h2s_full(key));

Modified: gnunet/src/dht/test_dht_multipeer_data.conf
===================================================================
--- gnunet/src/dht/test_dht_multipeer_data.conf 2010-07-30 13:40:40 UTC (rev 
12408)
+++ gnunet/src/dht/test_dht_multipeer_data.conf 2010-07-30 14:41:29 UTC (rev 
12409)
@@ -2,11 +2,12 @@
 AUTOSTART = NO
 
 [dht]
-DEBUG = YES
-STOP_ON_CLOSEST = YES
+DEBUG = NO
+STOP_ON_CLOSEST = NO
 AUTOSTART = YES
 ACCEPT_FROM6 = ::1;
 ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-dht
 #PREFIX = xterm -T dht -e gdb --args
 #PREFIX = valgrind --log-file=dht_%p
 CONFIG = $DEFAULTCONFIG
@@ -14,7 +15,6 @@
 HOSTNAME = localhost
 PORT = 2100
 
-
 [dhtcache]
 QUOTA = 1000000
 DATABASE = sqlite
@@ -31,6 +31,9 @@
 HOSTNAME = localhost
 PORT = 12365
 
+[DHTLOG]
+PLUGIN = mysql_dump
+
 [core]
 TOTAL_QUOTA_OUT = 3932160
 TOTAL_QUOTA_IN = 3932160
@@ -41,6 +44,7 @@
 HOME = $SERVICEHOME
 HOSTNAME = localhost
 PORT = 12092
+DEBUG = NO
 
 [arm]
 DEFAULTSERVICES = core dht
@@ -51,25 +55,26 @@
 HOME = $SERVICEHOME
 HOSTNAME = localhost
 PORT = 12366
-DEBUG = YES
+DEBUG = NO
 
 [transport-tcp]
 TIMEOUT = 300000
 PORT = 12368
 
 [DHT_TESTING]
-MYSQL_LOGGING_EXTENDED = NO
+MYSQL_LOGGING_EXTENDED = YES
 NUM_GETS = 10
-NUM_PUTS = 10
+NUM_PUTS = 50
 
 [TESTING]
-CONNECT_TOPOLOGY = CLIQUE
-CONNECT_TOPOLOGY_OPTION = CONNECT_RANDOM_SUBSET
-CONNECT_TOPOLOGY_OPTION_MODIFIER = 2
+TOPOLOGY = CLIQUE
+CONNECT_TOPOLOGY = RING
+#CONNECT_TOPOLOGY_OPTION = CONNECT_RANDOM_SUBSET
+#CONNECT_TOPOLOGY_OPTION_MODIFIER = 2
 #LOGNMODIFIER = .65
 #PERCENTAGE = .75
 WEAKRANDOM = YES
-NUM_PEERS = 5
+NUM_PEERS = 15
 
 [gnunetd]
 HOSTKEY = $SERVICEHOME/.hostkey

Modified: gnunet/src/dht/test_dhtlog_data.conf
===================================================================
--- gnunet/src/dht/test_dhtlog_data.conf        2010-07-30 13:40:40 UTC (rev 
12408)
+++ gnunet/src/dht/test_dhtlog_data.conf        2010-07-30 14:41:29 UTC (rev 
12409)
@@ -36,7 +36,8 @@
 SERVICEHOME = /tmp/test-dhtlog/
 
 [DHTLOG]
-PLUGIN = dummy
+PLUGIN = mysql_dump
+#PLUGIN = dummy
 #PLUGIN = mysql
 
 [MYSQL]




reply via email to

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