minor bugfixes
authorChristian Grothoff <christian@grothoff.org>
Tue, 10 Apr 2018 18:48:46 +0000 (20:48 +0200)
committerChristian Grothoff <christian@grothoff.org>
Tue, 10 Apr 2018 18:48:46 +0000 (20:48 +0200)
src/datacache/datacache.conf
src/datacache/test_datacache_data_postgres.conf
src/datastore/datastore.conf.in
src/namecache/namecache.conf.in
src/namestore/gnunet-zoneimport.c
src/namestore/namestore.conf.in
src/namestore/plugin_namestore_postgres.c

index 033b56db1420ee9bb41416853ef3d50e32c75fea..f9c718eb0bd1a4b9827c9cb56b684841e2e98e26 100644 (file)
@@ -1,2 +1,2 @@
 [datacache-postgres]
-CONFIG = connect_timeout=10; dbname=gnunet
+CONFIG = postgres:///gnunet
index 09e8e7253cb8210eebc347162d31cebd0ee43091..47c954b55e37a0243d325648d59adbead1767df5 100644 (file)
@@ -6,3 +6,4 @@ DATABASE = postgres
 [datacache-postgres]
 CONFIG = connect_timeout=10; dbname=gnunetcheck
 
+
index b6b7c13bc94b3b4c43b2267319d709751663d574..721c865c82093929ca21f2e78e1acab22ba069a1 100644 (file)
@@ -17,7 +17,7 @@ DATABASE = sqlite
 FILENAME = $GNUNET_DATA_HOME/datastore/sqlite.db
 
 [datastore-postgres]
-CONFIG = connect_timeout=10; dbname=gnunet
+CONFIG = postgres:///gnunet
 
 [datastore-mysql]
 DATABASE = gnunet
index f70fa487e458d55bec3d09f0cf2befe17b2e9c04..236cafecd89525eae1b843d621e5b15111ce72c1 100644 (file)
@@ -18,7 +18,7 @@ FILENAME = $GNUNET_DATA_HOME/namecache/sqlite.db
 FILENAME = $GNUNET_DATA_HOME/namecache/flat.db
 
 [namecache-postgres]
-CONFIG = connect_timeout=10; dbname=gnunet
+CONFIG = postgres:///gnunet
 TEMPORARY_TABLE = NO
 
 
index 75bf6d6397503ba51e31f767502a2561a87b214a..763a94c3add0f35d81a9da757f0cd23a2ebee329 100644 (file)
@@ -162,6 +162,11 @@ static unsigned int pending;
  */
 static unsigned int lookups;
 
+/**
+ * How many hostnames did we reject (malformed).
+ */
+static unsigned int rejects;
+
 /**
  * Number of lookups that failed.
  */
@@ -805,14 +810,12 @@ process_result (void *cls,
       = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_DAYS);
   /* convert records to namestore import format */
   {
-    struct GNUNET_GNSRECORD_Data rd[rd_count];
-    unsigned int off;
+    struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL(rd_count)];
+    unsigned int off = 0;
 
     /* convert linked list into array */
-    for (rec = req->rec_head, off = 0;
-        NULL != rec;
-        rec =rec->next, off++)
-      rd[off] = rec->grd;
+    for (rec = req->rec_head; NULL != rec; rec =rec->next)
+      rd[off++] = rec->grd;
     if (GNUNET_OK != 
        ns->store_records (ns->cls,
                           &zone,
@@ -820,9 +823,17 @@ process_result (void *cls,
                           rd_count,
                           rd))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                 "Failed to store zone data for `%s'\n",
-                 req->hostname);
+      if (0 != rd_count)
+       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                   "Failed to store zone data for `%s'\n",
+                   req->hostname);
+    }
+    else
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                 "Stored %u records under `%s'\n",
+                 (unsigned int) rd_count,
+                 req->label);
     }
   }
   insert_sorted (req);
@@ -893,8 +904,9 @@ process_queue(void *cls)
     if (GNUNET_TIME_absolute_get_remaining (req_head->expires).rel_value_us > 0)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                 "Waiting until %s for next record to expire\n",
-                 GNUNET_STRINGS_absolute_time_to_string (req_head->expires));
+                 "Waiting until %s for next record (`%s') to expire\n",
+                 GNUNET_STRINGS_absolute_time_to_string (req_head->expires),
+                 req_head->hostname);
       t = GNUNET_SCHEDULER_add_at (req_head->expires,
                                   &process_queue,
                                   NULL);
@@ -1007,6 +1019,7 @@ queue (const char *hostname)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Refusing invalid hostname `%s'\n",
                 hostname);
+    rejects++;
     return;
   }
   /* TODO: may later support importing zones that
@@ -1020,6 +1033,7 @@ queue (const char *hostname)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Refusing invalid hostname `%s' (lacks '.')\n",
                 hostname);
+    rejects++;
     return;
   }
   q.name = (char *) hostname;
@@ -1043,6 +1057,7 @@ queue (const char *hostname)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Failed to pack query for hostname `%s'\n",
                 hostname);
+    rejects++;
     return;
   }
 
@@ -1059,6 +1074,7 @@ queue (const char *hostname)
     GNUNET_free (req->hostname);
     GNUNET_free (req->label);
     GNUNET_free (req);
+    rejects++;
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Label contained a `.', invalid hostname `%s'\n",
                 hostname);
@@ -1071,10 +1087,16 @@ queue (const char *hostname)
                          &import_records,
                          req))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Failed to load data from namestore for `%s'\n",
                 req->label);
   }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Succeeded hot-start with existing data for `%s'\n",
+                req->label);
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Adding `%s' to worklist to start at %s\n",
              req->hostname,
@@ -1265,7 +1287,8 @@ main (int argc,
                      NULL);
   GNUNET_free ((void*) argv);
   fprintf (stderr,
-           "Did %u lookups, found %u records, %u lookups failed, %u pending on shutdown\n",
+           "Rejected %u names, did %u lookups, found %u records, %u lookups failed, %u pending on shutdown\n",
+          rejects,
            lookups,
            records,
            failures,
index 89fa945bce3553b40a428cf1f51ec70a2fb92f17..0ebd2586bb10f6408e6eb74f62ef5ddbad3b7ec5 100644 (file)
@@ -19,7 +19,7 @@ FILENAME = $GNUNET_DATA_HOME/namestore/flat.db
 
 
 [namestore-postgres]
-CONFIG = connect_timeout=10; dbname=gnunet
+CONFIG = postgres:///gnunet
 TEMPORARY_TABLE = NO
 
 [uri]
index de8d76853d566a9fd5d43a2708ed3998ee763d64..9c6d05a212ad8b4dace9d6dbc4c7de029c2a9ec3 100644 (file)
@@ -1,6 +1,6 @@
  /*
   * This file is part of GNUnet
-  * Copyright (C) 2009-2013, 2016, 2017 GNUnet e.V.
+  * Copyright (C) 2009-2013, 2016-2018 GNUnet e.V.
   *
   * GNUnet is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published
@@ -319,7 +319,7 @@ parse_result_call_iterator (void *cls,
     }
 
     {
-      struct GNUNET_GNSRECORD_Data rd[record_count];
+      struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL(record_count)];
 
       if (GNUNET_OK !=
           GNUNET_GNSRECORD_records_deserialize (data_size,