}
if (lowestRestartDelay.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will restart process in %llums\n",
- (unsigned long long) lowestRestartDelay.rel_value);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Will restart process in %s\n",
+ GNUNET_STRINGS_relative_time_to_string (lowestRestartDelay, GNUNET_YES));
child_restart_task =
GNUNET_SCHEDULER_add_delayed_with_priority (lowestRestartDelay,
GNUNET_SCHEDULER_PRIORITY_IDLE,
k = n;
}
FPRINTF (stderr, "%s", "\n");
- FPRINTF (stdout, "Stored %u items in %llums\n", ITERATIONS,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value);
+ FPRINTF (stdout, "Stored %u items in %s\n", ITERATIONS,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name);
GAUGER (gstr, "Time to PUT item in datacache",
GNUNET_TIME_absolute_get_duration (start).rel_value / ITERATIONS,
}
FPRINTF (stderr, "%s", "\n");
FPRINTF (stdout,
- "Found %u/%u items in %llums (%u were deleted during storage processing)\n",
+ "Found %u/%u items in %s (%u were deleted during storage processing)\n",
found, ITERATIONS,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
ITERATIONS - found);
if (found > 0)
GAUGER (gstr, "Time to GET item from datacache",
int64_t dval;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' of %u bytes with key `%4s' and expiration %llums\n",
+ "Processing `%s' of %u bytes with key `%4s' and expiration %s\n",
"PUT", (unsigned int) size, GNUNET_h2s (key),
(unsigned long long)
- GNUNET_TIME_absolute_get_remaining (discard_time).rel_value);
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (discard_time), GNUNET_YES));
dval = (int64_t) discard_time.abs_value;
if (dval < 0)
dval = INT64_MAX;
GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", "SERVERS",
&servers))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("No `%s' specified in `%s' configuration, will not bootstrap.\n"),
- "SERVERS", "HOSTLIST");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "hostlist", "SERVERS");
return NULL;
}
}
if (urls == 0)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("No `%s' specified in `%s' configuration, will not bootstrap.\n"),
- "SERVERS", "HOSTLIST");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "hostlist", "SERVERS");
GNUNET_free (servers);
return NULL;
}
temp = val1 + val2;
if (temp < val1)
return maxv;
- else
- return temp;
+ return temp;
}
+
/**
* Subtract val2 from val1 with underflow check
* @param val1 value 1
{
if (val1 <= val2)
return 0;
- else
- return (val1 - val2);
+ return (val1 - val2);
}
+
/**
* Method to check if a URI is in hostlist linked list
* @param uri uri to check
stat_use_bootstrap = GNUNET_YES;
}
+
/**
* Clean up the state from the task that downloaded the
* hostlist and schedule the next task.
}
}
+
/**
* Task that checks if we should try to download a hostlist.
* If so, we initiate the download, otherwise we schedule
once = 1;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _
- ("Have %u/%u connections. Will consider downloading hostlist in %llums\n"),
+ _("Have %u/%u connections. Will consider downloading hostlist in %s\n"),
stat_connection_count, MIN_CONNECTIONS,
- (unsigned long long) delay.rel_value);
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
ti_check_download = GNUNET_SCHEDULER_add_delayed (delay, &task_check, NULL);
}
ti_saving_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Scheduled saving of hostlists\n"));
save_hostlist_file (GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Hostlists will be saved to file again in %llums\n"),
- (unsigned long long) SAVING_INTERVALL.rel_value);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Hostlists will be saved to file again in %s\n",
+ GNUNET_STRINGS_relative_time_to_string(SAVING_INTERVALL, GNUNET_YES));
ti_saving_task =
GNUNET_SCHEDULER_add_delayed (SAVING_INTERVALL, &task_hostlist_saving,
NULL);
}
-
/**
* Continuation called by the statistics code once
* we go the stat. Initiates hostlist download scheduling.
process_stat (void *cls, const char *subsystem, const char *name,
uint64_t value, int is_persistent)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Initial time between hostlist downloads is %llums\n"),
- (unsigned long long) value);
hostlist_delay.rel_value = value;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Initial time between hostlist downloads is %s\n",
+ GNUNET_STRINGS_relative_time_to_string (hostlist_delay, GNUNET_YES));
return GNUNET_OK;
}
+
/**
* Method to load persistent hostlist file during hostlist client startup
*/
GNUNET_CONFIGURATION_get_value_filename (cfg, "HOSTLIST", "HOSTLISTFILE",
&filename))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("No `%s' specified in `%s' configuration, cannot load hostlists from file.\n"),
- "HOSTLISTFILE", "HOSTLIST");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "hostlist", "HOSTLISTFILE");
return;
}
if (GNUNET_NO == GNUNET_DISK_file_test (filename))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Hostlist file `%s' is not existing\n"), filename);
+ _("Hostlist file `%s' does not exist\n"), filename);
GNUNET_free (filename);
return;
}
GNUNET_CONFIGURATION_get_value_filename (cfg, "HOSTLIST", "HOSTLISTFILE",
&filename))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("No `%s' specified in `%s' configuration, cannot save hostlists to file.\n"),
- "HOSTLISTFILE", "HOSTLIST");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "hostlist", "HOSTLISTFILE");
return;
}
if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename))
GNUNET_free (filename);
}
+
/**
* Start downloading hostlists from hostlist servers as necessary.
*/
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Learning is enabled on this peer\n"));
load_hostlist_file ();
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Hostlists will be saved to file again in %llums\n"),
- (unsigned long long) SAVING_INTERVALL.rel_value);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Hostlists will be saved to file again in %s\n",
+ GNUNET_STRINGS_relative_time_to_string (SAVING_INTERVALL, GNUNET_YES));
ti_saving_task =
GNUNET_SCHEDULER_add_delayed (SAVING_INTERVALL, &task_hostlist_saving,
NULL);
{
GNUNET_assert (NULL == peer);
pitr = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Error in communication with PEERINFO service: %s\n"),
err_msg);
return;
if (NULL == *con_cls)
{
(*con_cls) = &dummy;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Sending 100 CONTINUE reply\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending 100 CONTINUE reply\n");
return MHD_YES; /* send 100 continue */
}
if (0 != *upload_data_size)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peerinfo is notifying us to rebuild our hostlist\n");
if (NULL != err_msg)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Error in communication with PEERINFO service: %s\n"),
err_msg);
if (NULL != pitr)
if ((h->internal_address != NULL) &&
(inet_pton (AF_INET, h->internal_address, &in_addr) != 1))
{
- LOG (GNUNET_ERROR_TYPE_WARNING, "nat",
- _("Malformed %s `%s' given in configuration!\n"), "INTERNAL_ADDRESS",
- h->internal_address);
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ "nat", "INTERNAL_ADDRESS",
+ _("malformed"));
GNUNET_free (h->internal_address);
h->internal_address = NULL;
}
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_bandwidth_lib.h"
-#include "gnunet_server_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util-bandwidth", __VA_ARGS__)
b = ntohl (bps.value__);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Bandwidth has %llu bytes available until deadline in %llums\n",
+ "Bandwidth has %llu bytes available until deadline in %s\n",
(unsigned long long) ((b * deadline.rel_value + 500LL) / 1000LL),
- deadline.rel_value);
+ GNUNET_STRINGS_relative_time_to_string (deadline, GNUNET_YES));
return (b * deadline.rel_value + 500LL) / 1000LL;
}
* connections between clients and service providers.
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_client_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
/**
(th->client->back_off, 2),
GNUNET_TIME_UNIT_SECONDS);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Transmission failed %u times, trying again in %llums.\n",
+ "Transmission failed %u times, trying again in %s.\n",
MAX_ATTEMPTS - th->attempts_left,
- (unsigned long long) delay.rel_value);
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
th->reconnect_task =
GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th);
return;
(client->back_off, 2),
GNUNET_TIME_UNIT_SECONDS);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Transmission failed %u times, trying again in %llums.\n",
+ "Transmission failed %u times, trying again in %s.\n",
MAX_ATTEMPTS - th->attempts_left,
- (unsigned long long) delay.rel_value);
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
client->th = th;
th->reconnect_task =
GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th);
if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value >
DELAY_THRESHOLD.rel_value)
{
- LOG (GNUNET_ERROR_TYPE_ERROR, "Task %llu took %llums to be scheduled\n",
- pos->id,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Task %llu took %s to be scheduled\n",
+ (unsigned long long) pos->id,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES));
}
#endif
tc.reason = pos->reason;
&warn_no_receive_done, client);
if (0 == (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
LOG (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Processing code for message of type %u did not call GNUNET_SERVER_receive_done after %llums\n"),
+ _("Processing code for message of type %u did not call `GNUNET_SERVER_receive_done' after %s\n"),
(unsigned int) client->warn_type,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (client->warn_start).rel_value);
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (client->warn_start), GNUNET_YES));
}
continue;
}
}
- printf ("%d RSA encrypt/decrypt operations %llums (%d failures)\n", ITER,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value, ok);
+ printf ("%d RSA encrypt/decrypt operations %s (%d failures)\n",
+ ITER,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
+ ok);
if (ok == 0)
return GNUNET_OK;
else
continue;
}
}
- printf ("%d RSA sign/verify operations %llums\n", ITER,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value);
+ printf ("%d RSA sign/verify operations %s\n",
+ ITER,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
return ok;
}
continue;
}
}
- printf ("%d RSA encrypt/decrypt operations %llums (%d failures)\n", ITER,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value, ok);
+ printf ("%d RSA encrypt/decrypt operations %s (%d failures)\n",
+ ITER,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
+ ok);
if (ok == 0)
return GNUNET_OK;
return GNUNET_SYSERR;
continue;
}
}
- printf ("%d RSA encrypt/decrypt SK operations %llums (%d failures)\n", ITER,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value, ok);
+ printf ("%d RSA encrypt/decrypt SK operations %s (%d failures)\n",
+ ITER,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
+ ok);
if (ok != 0)
return GNUNET_SYSERR;
return GNUNET_OK;
continue;
}
}
- printf ("%d RSA sign/verify operations %llums\n", ITER,
- (unsigned long long)
- GNUNET_TIME_absolute_get_duration (start).rel_value);
+ printf ("%d RSA sign/verify operations %s\n", ITER,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
return ok;
}