aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2020-10-06 07:20:48 +0200
committert3sserakt <t3ss@posteo.de>2020-10-06 07:22:03 +0200
commitc25c3fd24b691d35674b1e67cbcf1066c427c7d3 (patch)
tree78fc68ab20c10db73c3e111898c0f4034edce832 /src
parent8c40115c58f639edc17ff242ec1a79c2078dc301 (diff)
parentdaa0f22b63c1442ad51122e5ba140c1ae5890267 (diff)
downloadgnunet-c25c3fd24b691d35674b1e67cbcf1066c427c7d3.tar.gz
gnunet-c25c3fd24b691d35674b1e67cbcf1066c427c7d3.zip
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src')
-rw-r--r--src/datacache/plugin_datacache_postgres.c9
-rw-r--r--src/datastore/plugin_datastore_postgres.c14
-rw-r--r--src/namecache/plugin_namecache_postgres.c6
-rw-r--r--src/namestore/plugin_namestore_postgres.c6
-rw-r--r--src/transport/gnunet-service-transport.c2
-rw-r--r--src/util/strings.c22
6 files changed, 34 insertions, 25 deletions
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index c21be9219..724324ca4 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -67,14 +67,19 @@ static int
67init_connection (struct Plugin *plugin) 67init_connection (struct Plugin *plugin)
68{ 68{
69 struct GNUNET_PQ_ExecuteStatement es[] = { 69 struct GNUNET_PQ_ExecuteStatement es[] = {
70 GNUNET_PQ_make_try_execute ("CREATE TEMPORARY SEQUENCE IF NOT EXISTS gn011dc_oid_seq"),
70 GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn011dc (" 71 GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn011dc ("
72 " oid OID NOT NULL DEFAULT nextval('gn011dc_oid_seq'),"
71 " type INTEGER NOT NULL," 73 " type INTEGER NOT NULL,"
72 " prox INTEGER NOT NULL," 74 " prox INTEGER NOT NULL,"
73 " discard_time BIGINT NOT NULL," 75 " discard_time BIGINT NOT NULL,"
74 " key BYTEA NOT NULL," 76 " key BYTEA NOT NULL,"
75 " value BYTEA NOT NULL," 77 " value BYTEA NOT NULL,"
76 " path BYTEA DEFAULT NULL)" 78 " path BYTEA DEFAULT NULL)"),
77 "WITH OIDS"), 79 GNUNET_PQ_make_try_execute (
80 "ALTER SEQUENCE gnu011dc_oid_seq OWNED BY gn011dc.oid"),
81 GNUNET_PQ_make_try_execute (
82 "CREATE INDEX IF NOT EXISTS idx_oid ON gn011dc (oid)"),
78 GNUNET_PQ_make_try_execute ( 83 GNUNET_PQ_make_try_execute (
79 "CREATE INDEX IF NOT EXISTS idx_key ON gn011dc (key)"), 84 "CREATE INDEX IF NOT EXISTS idx_key ON gn011dc (key)"),
80 GNUNET_PQ_make_try_execute ( 85 GNUNET_PQ_make_try_execute (
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 88ceb1b0a..6a5d45832 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -72,8 +72,10 @@ init_connection (struct Plugin *plugin)
72 * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel 72 * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel
73 * we do math or inequality tests, so we can't handle the entire range of uint32_t. 73 * we do math or inequality tests, so we can't handle the entire range of uint32_t.
74 * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC. 74 * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC.
75 * PostgreSQL also recommends against using WITH OIDS. 75 */
76 */GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 (" 76 GNUNET_PQ_make_try_execute (
77 "CREATE SEQUENCE IF NOT EXISTS gn090_oid_seq"),
78 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 ("
77 " repl INTEGER NOT NULL DEFAULT 0," 79 " repl INTEGER NOT NULL DEFAULT 0,"
78 " type INTEGER NOT NULL DEFAULT 0," 80 " type INTEGER NOT NULL DEFAULT 0,"
79 " prio INTEGER NOT NULL DEFAULT 0," 81 " prio INTEGER NOT NULL DEFAULT 0,"
@@ -82,8 +84,12 @@ init_connection (struct Plugin *plugin)
82 " rvalue BIGINT NOT NULL DEFAULT 0," 84 " rvalue BIGINT NOT NULL DEFAULT 0,"
83 " hash BYTEA NOT NULL DEFAULT ''," 85 " hash BYTEA NOT NULL DEFAULT '',"
84 " vhash BYTEA NOT NULL DEFAULT ''," 86 " vhash BYTEA NOT NULL DEFAULT '',"
85 " value BYTEA NOT NULL DEFAULT '')" 87 " value BYTEA NOT NULL DEFAULT '',"
86 "WITH OIDS"), 88 " oid OID NOT NULL DEFAULT nextval('gn090_oid_seq'))"),
89 GNUNET_PQ_make_try_execute (
90 "ALTER SEQUENCE gn090_oid_seq OWNED BY gn090.oid"),
91 GNUNET_PQ_make_try_execute (
92 "CREATE INDEX IF NOT EXISTS oid_hash ON gn090 (oid)"),
87 GNUNET_PQ_make_try_execute ( 93 GNUNET_PQ_make_try_execute (
88 "CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash)"), 94 "CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash)"),
89 GNUNET_PQ_make_try_execute ( 95 GNUNET_PQ_make_try_execute (
diff --git a/src/namecache/plugin_namecache_postgres.c b/src/namecache/plugin_namecache_postgres.c
index 0e947e9c5..654a3ae81 100644
--- a/src/namecache/plugin_namecache_postgres.c
+++ b/src/namecache/plugin_namecache_postgres.c
@@ -64,15 +64,13 @@ database_setup (struct Plugin *plugin)
64 " query BYTEA NOT NULL DEFAULT ''," 64 " query BYTEA NOT NULL DEFAULT '',"
65 " block BYTEA NOT NULL DEFAULT ''," 65 " block BYTEA NOT NULL DEFAULT '',"
66 " expiration_time BIGINT NOT NULL DEFAULT 0" 66 " expiration_time BIGINT NOT NULL DEFAULT 0"
67 ")" 67 ")");
68 "WITH OIDS");
69 struct GNUNET_PQ_ExecuteStatement es_default = 68 struct GNUNET_PQ_ExecuteStatement es_default =
70 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns096blocks (" 69 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns096blocks ("
71 " query BYTEA NOT NULL DEFAULT ''," 70 " query BYTEA NOT NULL DEFAULT '',"
72 " block BYTEA NOT NULL DEFAULT ''," 71 " block BYTEA NOT NULL DEFAULT '',"
73 " expiration_time BIGINT NOT NULL DEFAULT 0" 72 " expiration_time BIGINT NOT NULL DEFAULT 0"
74 ")" 73 ")");
75 "WITH OIDS");
76 const struct GNUNET_PQ_ExecuteStatement *cr; 74 const struct GNUNET_PQ_ExecuteStatement *cr;
77 75
78 if (GNUNET_YES == 76 if (GNUNET_YES ==
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 01dddde9e..04100567c 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -73,8 +73,7 @@ database_setup (struct Plugin *plugin)
73 " record_data BYTEA NOT NULL DEFAULT ''," 73 " record_data BYTEA NOT NULL DEFAULT '',"
74 " label TEXT NOT NULL DEFAULT ''," 74 " label TEXT NOT NULL DEFAULT '',"
75 " CONSTRAINT zl UNIQUE (zone_private_key,label)" 75 " CONSTRAINT zl UNIQUE (zone_private_key,label)"
76 ")" 76 ")");
77 "WITH OIDS");
78 struct GNUNET_PQ_ExecuteStatement es_default = 77 struct GNUNET_PQ_ExecuteStatement es_default =
79 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records (" 78 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records ("
80 " seq BIGSERIAL PRIMARY KEY," 79 " seq BIGSERIAL PRIMARY KEY,"
@@ -85,8 +84,7 @@ database_setup (struct Plugin *plugin)
85 " record_data BYTEA NOT NULL DEFAULT ''," 84 " record_data BYTEA NOT NULL DEFAULT '',"
86 " label TEXT NOT NULL DEFAULT ''," 85 " label TEXT NOT NULL DEFAULT '',"
87 " CONSTRAINT zl UNIQUE (zone_private_key,label)" 86 " CONSTRAINT zl UNIQUE (zone_private_key,label)"
88 ")" 87 ")");
89 "WITH OIDS");
90 const struct GNUNET_PQ_ExecuteStatement *cr; 88 const struct GNUNET_PQ_ExecuteStatement *cr;
91 struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END; 89 struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END;
92 90
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 207c17f2f..92e37a91c 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -700,6 +700,7 @@ handle_send_transmit_continuation (void *cls,
700 700
701 delay = GNUNET_TIME_absolute_get_duration (stcc->send_time); 701 delay = GNUNET_TIME_absolute_get_duration (stcc->send_time);
702 addr = GST_neighbour_get_current_address (&stcc->target); 702 addr = GST_neighbour_get_current_address (&stcc->target);
703#ifdef ENABLE_TTD
703 if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) 704 if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
704 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 705 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
705 "It took us %s to send %u/%u bytes to %s (%d, %s)\n", 706 "It took us %s to send %u/%u bytes to %s (%d, %s)\n",
@@ -718,6 +719,7 @@ handle_send_transmit_continuation (void *cls,
718 GNUNET_i2s (&stcc->target), 719 GNUNET_i2s (&stcc->target),
719 success, 720 success,
720 (NULL != addr) ? addr->transport_name : "%"); 721 (NULL != addr) ? addr->transport_name : "%");
722#endif
721 723
722 if (GNUNET_NO == stcc->down) 724 if (GNUNET_NO == stcc->down)
723 { 725 {
diff --git a/src/util/strings.c b/src/util/strings.c
index 9d6f4039e..381b66e1e 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -176,7 +176,7 @@ GNUNET_STRINGS_buffer_tokenize (const char *buffer,
176char * 176char *
177GNUNET_STRINGS_byte_size_fancy (unsigned long long size) 177GNUNET_STRINGS_byte_size_fancy (unsigned long long size)
178{ 178{
179 const char *unit = _ (/* size unit */ "b"); 179 const char *unit = /* size unit */ "b";
180 char *ret; 180 char *ret;
181 181
182 if (size > 5 * 1024) 182 if (size > 5 * 1024)
@@ -703,37 +703,37 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
703 int do_round) 703 int do_round)
704{ 704{
705 static GNUNET_THREAD_LOCAL char buf[128]; 705 static GNUNET_THREAD_LOCAL char buf[128];
706 const char *unit = _ (/* time unit */ "µs"); 706 const char *unit = /* time unit */ "µs";
707 uint64_t dval = delta.rel_value_us; 707 uint64_t dval = delta.rel_value_us;
708 708
709 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == delta.rel_value_us) 709 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == delta.rel_value_us)
710 return _ ("forever"); 710 return "forever";
711 if (0 == delta.rel_value_us) 711 if (0 == delta.rel_value_us)
712 return _ ("0 ms"); 712 return "0 ms";
713 if (((GNUNET_YES == do_round) && (dval > 5 * 1000)) || (0 == (dval % 1000))) 713 if (((GNUNET_YES == do_round) && (dval > 5 * 1000)) || (0 == (dval % 1000)))
714 { 714 {
715 dval = dval / 1000; 715 dval = dval / 1000;
716 unit = _ (/* time unit */ "ms"); 716 unit = /* time unit */ "ms";
717 if (((GNUNET_YES == do_round) && (dval > 5 * 1000)) || (0 == (dval % 1000))) 717 if (((GNUNET_YES == do_round) && (dval > 5 * 1000)) || (0 == (dval % 1000)))
718 { 718 {
719 dval = dval / 1000; 719 dval = dval / 1000;
720 unit = _ (/* time unit */ "s"); 720 unit = /* time unit */ "s";
721 if (((GNUNET_YES == do_round) && (dval > 5 * 60)) || (0 == (dval % 60))) 721 if (((GNUNET_YES == do_round) && (dval > 5 * 60)) || (0 == (dval % 60)))
722 { 722 {
723 dval = dval / 60; 723 dval = dval / 60;
724 unit = _ (/* time unit */ "m"); 724 unit = /* time unit */ "m";
725 if (((GNUNET_YES == do_round) && (dval > 5 * 60)) || (0 == (dval % 60))) 725 if (((GNUNET_YES == do_round) && (dval > 5 * 60)) || (0 == (dval % 60)))
726 { 726 {
727 dval = dval / 60; 727 dval = dval / 60;
728 unit = _ (/* time unit */ "h"); 728 unit = /* time unit */ "h";
729 if (((GNUNET_YES == do_round) && (dval > 5 * 24)) || 729 if (((GNUNET_YES == do_round) && (dval > 5 * 24)) ||
730 (0 == (dval % 24))) 730 (0 == (dval % 24)))
731 { 731 {
732 dval = dval / 24; 732 dval = dval / 24;
733 if (1 == dval) 733 if (1 == dval)
734 unit = _ (/* time unit */ "day"); 734 unit = /* time unit */ "day";
735 else 735 else
736 unit = _ (/* time unit */ "days"); 736 unit = /* time unit */ "days";
737 } 737 }
738 } 738 }
739 } 739 }
@@ -761,7 +761,7 @@ GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t)
761 struct tm *tp; 761 struct tm *tp;
762 762
763 if (t.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) 763 if (t.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us)
764 return _ ("end of time"); 764 return "end of time";
765 tt = t.abs_value_us / 1000LL / 1000LL; 765 tt = t.abs_value_us / 1000LL / 1000LL;
766 tp = localtime (&tt); 766 tp = localtime (&tt);
767 /* This is hacky, but i don't know a way to detect libc character encoding. 767 /* This is hacky, but i don't know a way to detect libc character encoding.