aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/escrow_plugin_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/escrow/escrow_plugin_helper.c')
-rw-r--r--src/escrow/escrow_plugin_helper.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index 3e14edf4f..f5f67d4bf 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -315,44 +315,39 @@ ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h,
315 "LAST_ESCROW_TIME", 315 "LAST_ESCROW_TIME",
316 &conf_last_escrow)) 316 &conf_last_escrow))
317 { 317 {
318 // TODO: is that the behavior when the section is not defined? 318 /* failed to get value from config, set last escrow time to zero */
319 status->last_escrow_time = GNUNET_TIME_absolute_get_zero_(); 319 status->last_escrow_time = GNUNET_TIME_absolute_get_zero_();
320 } 320 }
321 else
322 status->last_escrow_time.abs_value_us = (uint64_t)conf_last_escrow;
323
321 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg, 324 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (h->cfg,
322 config_section, 325 config_section,
323 "NEXT_RECOMMENDED_ESCROW_TIME", 326 "NEXT_RECOMMENDED_ESCROW_TIME",
324 &conf_next_escrow)) 327 &conf_next_escrow))
325 { 328 {
326 // TODO: is that the behavior when the section is not defined? 329 /* failed to get value from config, set next recommended escrow to now */
327 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get (); 330 status->next_recommended_escrow_time = GNUNET_TIME_absolute_get ();
328 } 331 }
329 status->last_method = GNUNET_ESCROW_KEY_NONE; 332 else
333 status->next_recommended_escrow_time.abs_value_us = (uint64_t)conf_next_escrow;
334
330 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg, 335 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg,
331 config_section, 336 config_section,
332 "ESCROW_METHOD", 337 "ESCROW_METHOD",
333 &conf_escrow_method)) 338 &conf_escrow_method))
334 { 339 {
335 // TODO: error handling? 340 /* failed to get value from config, set last method to NONE */
336 } 341 status->last_method = GNUNET_ESCROW_KEY_NONE;
337 status->last_escrow_time.abs_value_us = (uint64_t)conf_last_escrow;
338 status->next_recommended_escrow_time.abs_value_us = (uint64_t)conf_next_escrow;
339 if (NULL != conf_escrow_method)
340 {
341 if (NULL != conf_escrow_method && 0 == strcmp (conf_escrow_method, "plaintext"))
342 status->last_method = GNUNET_ESCROW_KEY_PLAINTEXT;
343 else if (0 == strcmp (conf_escrow_method, "gns"))
344 status->last_method = GNUNET_ESCROW_KEY_GNS;
345 else if (0 == strcmp (conf_escrow_method, "anastasis"))
346 status->last_method = GNUNET_ESCROW_KEY_ANASTASIS;
347 else
348 status->last_method = GNUNET_ESCROW_KEY_NONE;
349 } 342 }
343 else
344 status->last_method = GNUNET_ESCROW_method_string_to_number (conf_escrow_method);
350 345
351
352 GNUNET_free (config_section); 346 GNUNET_free (config_section);
353 GNUNET_free (pubkey_string); 347 GNUNET_free (pubkey_string);
354 GNUNET_free (pub); 348 GNUNET_free (pub);
355 GNUNET_free (conf_escrow_method); 349 if (NULL != conf_escrow_method)
350 GNUNET_free (conf_escrow_method);
356 351
357 return status; 352 return status;
358} 353}