aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/datacache/datacache.conf2
-rw-r--r--src/datacache/test_datacache_data_postgres.conf1
-rw-r--r--src/datastore/datastore.conf.in2
-rw-r--r--src/namecache/namecache.conf.in2
-rw-r--r--src/namestore/gnunet-zoneimport.c49
-rw-r--r--src/namestore/namestore.conf.in2
-rw-r--r--src/namestore/plugin_namestore_postgres.c4
7 files changed, 43 insertions, 19 deletions
diff --git a/src/datacache/datacache.conf b/src/datacache/datacache.conf
index 033b56db1..f9c718eb0 100644
--- a/src/datacache/datacache.conf
+++ b/src/datacache/datacache.conf
@@ -1,2 +1,2 @@
1[datacache-postgres] 1[datacache-postgres]
2CONFIG = connect_timeout=10; dbname=gnunet 2CONFIG = postgres:///gnunet
diff --git a/src/datacache/test_datacache_data_postgres.conf b/src/datacache/test_datacache_data_postgres.conf
index 09e8e7253..47c954b55 100644
--- a/src/datacache/test_datacache_data_postgres.conf
+++ b/src/datacache/test_datacache_data_postgres.conf
@@ -6,3 +6,4 @@ DATABASE = postgres
6[datacache-postgres] 6[datacache-postgres]
7CONFIG = connect_timeout=10; dbname=gnunetcheck 7CONFIG = connect_timeout=10; dbname=gnunetcheck
8 8
9
diff --git a/src/datastore/datastore.conf.in b/src/datastore/datastore.conf.in
index b6b7c13bc..721c865c8 100644
--- a/src/datastore/datastore.conf.in
+++ b/src/datastore/datastore.conf.in
@@ -17,7 +17,7 @@ DATABASE = sqlite
17FILENAME = $GNUNET_DATA_HOME/datastore/sqlite.db 17FILENAME = $GNUNET_DATA_HOME/datastore/sqlite.db
18 18
19[datastore-postgres] 19[datastore-postgres]
20CONFIG = connect_timeout=10; dbname=gnunet 20CONFIG = postgres:///gnunet
21 21
22[datastore-mysql] 22[datastore-mysql]
23DATABASE = gnunet 23DATABASE = gnunet
diff --git a/src/namecache/namecache.conf.in b/src/namecache/namecache.conf.in
index f70fa487e..236cafecd 100644
--- a/src/namecache/namecache.conf.in
+++ b/src/namecache/namecache.conf.in
@@ -18,7 +18,7 @@ FILENAME = $GNUNET_DATA_HOME/namecache/sqlite.db
18FILENAME = $GNUNET_DATA_HOME/namecache/flat.db 18FILENAME = $GNUNET_DATA_HOME/namecache/flat.db
19 19
20[namecache-postgres] 20[namecache-postgres]
21CONFIG = connect_timeout=10; dbname=gnunet 21CONFIG = postgres:///gnunet
22TEMPORARY_TABLE = NO 22TEMPORARY_TABLE = NO
23 23
24 24
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 75bf6d639..763a94c3a 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -163,6 +163,11 @@ static unsigned int pending;
163static unsigned int lookups; 163static unsigned int lookups;
164 164
165/** 165/**
166 * How many hostnames did we reject (malformed).
167 */
168static unsigned int rejects;
169
170/**
166 * Number of lookups that failed. 171 * Number of lookups that failed.
167 */ 172 */
168static unsigned int failures; 173static unsigned int failures;
@@ -805,14 +810,12 @@ process_result (void *cls,
805 = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_DAYS); 810 = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_DAYS);
806 /* convert records to namestore import format */ 811 /* convert records to namestore import format */
807 { 812 {
808 struct GNUNET_GNSRECORD_Data rd[rd_count]; 813 struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL(rd_count)];
809 unsigned int off; 814 unsigned int off = 0;
810 815
811 /* convert linked list into array */ 816 /* convert linked list into array */
812 for (rec = req->rec_head, off = 0; 817 for (rec = req->rec_head; NULL != rec; rec =rec->next)
813 NULL != rec; 818 rd[off++] = rec->grd;
814 rec =rec->next, off++)
815 rd[off] = rec->grd;
816 if (GNUNET_OK != 819 if (GNUNET_OK !=
817 ns->store_records (ns->cls, 820 ns->store_records (ns->cls,
818 &zone, 821 &zone,
@@ -820,9 +823,17 @@ process_result (void *cls,
820 rd_count, 823 rd_count,
821 rd)) 824 rd))
822 { 825 {
823 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 826 if (0 != rd_count)
824 "Failed to store zone data for `%s'\n", 827 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
825 req->hostname); 828 "Failed to store zone data for `%s'\n",
829 req->hostname);
830 }
831 else
832 {
833 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
834 "Stored %u records under `%s'\n",
835 (unsigned int) rd_count,
836 req->label);
826 } 837 }
827 } 838 }
828 insert_sorted (req); 839 insert_sorted (req);
@@ -893,8 +904,9 @@ process_queue(void *cls)
893 if (GNUNET_TIME_absolute_get_remaining (req_head->expires).rel_value_us > 0) 904 if (GNUNET_TIME_absolute_get_remaining (req_head->expires).rel_value_us > 0)
894 { 905 {
895 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 906 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
896 "Waiting until %s for next record to expire\n", 907 "Waiting until %s for next record (`%s') to expire\n",
897 GNUNET_STRINGS_absolute_time_to_string (req_head->expires)); 908 GNUNET_STRINGS_absolute_time_to_string (req_head->expires),
909 req_head->hostname);
898 t = GNUNET_SCHEDULER_add_at (req_head->expires, 910 t = GNUNET_SCHEDULER_add_at (req_head->expires,
899 &process_queue, 911 &process_queue,
900 NULL); 912 NULL);
@@ -1007,6 +1019,7 @@ queue (const char *hostname)
1007 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1019 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1008 "Refusing invalid hostname `%s'\n", 1020 "Refusing invalid hostname `%s'\n",
1009 hostname); 1021 hostname);
1022 rejects++;
1010 return; 1023 return;
1011 } 1024 }
1012 /* TODO: may later support importing zones that 1025 /* TODO: may later support importing zones that
@@ -1020,6 +1033,7 @@ queue (const char *hostname)
1020 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1033 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1021 "Refusing invalid hostname `%s' (lacks '.')\n", 1034 "Refusing invalid hostname `%s' (lacks '.')\n",
1022 hostname); 1035 hostname);
1036 rejects++;
1023 return; 1037 return;
1024 } 1038 }
1025 q.name = (char *) hostname; 1039 q.name = (char *) hostname;
@@ -1043,6 +1057,7 @@ queue (const char *hostname)
1043 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1057 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1044 "Failed to pack query for hostname `%s'\n", 1058 "Failed to pack query for hostname `%s'\n",
1045 hostname); 1059 hostname);
1060 rejects++;
1046 return; 1061 return;
1047 } 1062 }
1048 1063
@@ -1059,6 +1074,7 @@ queue (const char *hostname)
1059 GNUNET_free (req->hostname); 1074 GNUNET_free (req->hostname);
1060 GNUNET_free (req->label); 1075 GNUNET_free (req->label);
1061 GNUNET_free (req); 1076 GNUNET_free (req);
1077 rejects++;
1062 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1078 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1063 "Label contained a `.', invalid hostname `%s'\n", 1079 "Label contained a `.', invalid hostname `%s'\n",
1064 hostname); 1080 hostname);
@@ -1071,10 +1087,16 @@ queue (const char *hostname)
1071 &import_records, 1087 &import_records,
1072 req)) 1088 req))
1073 { 1089 {
1074 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1090 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1075 "Failed to load data from namestore for `%s'\n", 1091 "Failed to load data from namestore for `%s'\n",
1076 req->label); 1092 req->label);
1077 } 1093 }
1094 else
1095 {
1096 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1097 "Succeeded hot-start with existing data for `%s'\n",
1098 req->label);
1099 }
1078 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1079 "Adding `%s' to worklist to start at %s\n", 1101 "Adding `%s' to worklist to start at %s\n",
1080 req->hostname, 1102 req->hostname,
@@ -1265,7 +1287,8 @@ main (int argc,
1265 NULL); 1287 NULL);
1266 GNUNET_free ((void*) argv); 1288 GNUNET_free ((void*) argv);
1267 fprintf (stderr, 1289 fprintf (stderr,
1268 "Did %u lookups, found %u records, %u lookups failed, %u pending on shutdown\n", 1290 "Rejected %u names, did %u lookups, found %u records, %u lookups failed, %u pending on shutdown\n",
1291 rejects,
1269 lookups, 1292 lookups,
1270 records, 1293 records,
1271 failures, 1294 failures,
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in
index 89fa945bc..0ebd2586b 100644
--- a/src/namestore/namestore.conf.in
+++ b/src/namestore/namestore.conf.in
@@ -19,7 +19,7 @@ FILENAME = $GNUNET_DATA_HOME/namestore/flat.db
19 19
20 20
21[namestore-postgres] 21[namestore-postgres]
22CONFIG = connect_timeout=10; dbname=gnunet 22CONFIG = postgres:///gnunet
23TEMPORARY_TABLE = NO 23TEMPORARY_TABLE = NO
24 24
25[uri] 25[uri]
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index de8d76853..9c6d05a21 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -1,6 +1,6 @@
1 /* 1 /*
2 * This file is part of GNUnet 2 * This file is part of GNUnet
3 * Copyright (C) 2009-2013, 2016, 2017 GNUnet e.V. 3 * Copyright (C) 2009-2013, 2016-2018 GNUnet e.V.
4 * 4 *
5 * GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published 6 * it under the terms of the GNU General Public License as published
@@ -319,7 +319,7 @@ parse_result_call_iterator (void *cls,
319 } 319 }
320 320
321 { 321 {
322 struct GNUNET_GNSRECORD_Data rd[record_count]; 322 struct GNUNET_GNSRECORD_Data rd[GNUNET_NZL(record_count)];
323 323
324 if (GNUNET_OK != 324 if (GNUNET_OK !=
325 GNUNET_GNSRECORD_records_deserialize (data_size, 325 GNUNET_GNSRECORD_records_deserialize (data_size,