diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-31 14:46:57 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-31 14:46:57 +0100 |
commit | 68aa80774490e7f626bd4e34ca9ecda7fbbf9607 (patch) | |
tree | 32b65ae9b119e336595375ebf2597c18c79d6ac4 /src/dht | |
parent | 2503d0fdf24b506999ed927240c55d3863e6163c (diff) | |
download | gnunet-68aa80774490e7f626bd4e34ca9ecda7fbbf9607.tar.gz gnunet-68aa80774490e7f626bd4e34ca9ecda7fbbf9607.zip |
use modern time specification for expiration
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-dht-put.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c index 9b17da01f..64764cb65 100644 --- a/src/dht/gnunet-dht-put.c +++ b/src/dht/gnunet-dht-put.c | |||
@@ -44,7 +44,7 @@ static char *query_key; | |||
44 | /** | 44 | /** |
45 | * User supplied expiration value | 45 | * User supplied expiration value |
46 | */ | 46 | */ |
47 | static unsigned long long expiration_seconds = 3600; | 47 | static struct GNUNET_TIME_Relative expiration; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Desired replication level. | 50 | * Desired replication level. |
@@ -170,13 +170,11 @@ run (void *cls, | |||
170 | 170 | ||
171 | GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); | 171 | GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); |
172 | 172 | ||
173 | expiration = | ||
174 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply | ||
175 | (GNUNET_TIME_UNIT_SECONDS, | ||
176 | expiration_seconds)); | ||
177 | if (verbose) | 173 | if (verbose) |
178 | FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"), | 174 | FPRINTF (stderr, |
179 | query_key, data); | 175 | _("Issuing put request for `%s' with data `%s'!\n"), |
176 | query_key, | ||
177 | data); | ||
180 | ro = GNUNET_DHT_RO_NONE; | 178 | ro = GNUNET_DHT_RO_NONE; |
181 | if (demultixplex_everywhere) | 179 | if (demultixplex_everywhere) |
182 | ro |= GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; | 180 | ro |= GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; |
@@ -204,7 +202,7 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { | |||
204 | 1, &GNUNET_GETOPT_set_string, &data}, | 202 | 1, &GNUNET_GETOPT_set_string, &data}, |
205 | {'e', "expiration", "EXPIRATION", | 203 | {'e', "expiration", "EXPIRATION", |
206 | gettext_noop ("how long to store this entry in the dht (in seconds)"), | 204 | gettext_noop ("how long to store this entry in the dht (in seconds)"), |
207 | 1, &GNUNET_GETOPT_set_ulong, &expiration_seconds}, | 205 | 1, &GNUNET_GETOPT_set_relative_time, &expiration}, |
208 | {'k', "key", "KEY", | 206 | {'k', "key", "KEY", |
209 | gettext_noop ("the query key"), | 207 | gettext_noop ("the query key"), |
210 | 1, &GNUNET_GETOPT_set_string, &query_key}, | 208 | 1, &GNUNET_GETOPT_set_string, &query_key}, |
@@ -240,11 +238,17 @@ main (int argc, char *const *argv) | |||
240 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, | 238 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, |
241 | &argc, &argv)) | 239 | &argc, &argv)) |
242 | return 2; | 240 | return 2; |
241 | expiration = GNUNET_TIME_UNIT_HOURS; | ||
243 | return (GNUNET_OK == | 242 | return (GNUNET_OK == |
244 | GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-put", | 243 | GNUNET_PROGRAM_run (argc, |
244 | argv, | ||
245 | "gnunet-dht-put", | ||
245 | gettext_noop | 246 | gettext_noop |
246 | ("Issue a PUT request to the GNUnet DHT insert DATA under KEY."), | 247 | ("Issue a PUT request to the GNUnet DHT insert DATA under KEY."), |
247 | options, &run, NULL)) ? ret : 1; | 248 | options, |
249 | &run, | ||
250 | NULL)) | ||
251 | ? ret : 1; | ||
248 | } | 252 | } |
249 | 253 | ||
250 | /* end of gnunet-dht-put.c */ | 254 | /* end of gnunet-dht-put.c */ |