[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24062 - in gnunet/src: arm datacache hostlist nat util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24062 - in gnunet/src: arm datacache hostlist nat util |
Date: |
Thu, 27 Sep 2012 21:36:14 +0200 |
Author: grothoff
Date: 2012-09-27 21:36:14 +0200 (Thu, 27 Sep 2012)
New Revision: 24062
Modified:
gnunet/src/arm/gnunet-service-arm.c
gnunet/src/datacache/perf_datacache.c
gnunet/src/datacache/plugin_datacache_sqlite.c
gnunet/src/hostlist/hostlist-client.c
gnunet/src/hostlist/hostlist-server.c
gnunet/src/nat/nat.c
gnunet/src/util/bandwidth.c
gnunet/src/util/client.c
gnunet/src/util/scheduler.c
gnunet/src/util/server.c
gnunet/src/util/test_crypto_ksk.c
gnunet/src/util/test_crypto_rsa.c
Log:
-converting more places to use STRINGS_relative_time_to_string
Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/arm/gnunet-service-arm.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -903,8 +903,9 @@
}
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,
Modified: gnunet/src/datacache/perf_datacache.c
===================================================================
--- gnunet/src/datacache/perf_datacache.c 2012-09-27 19:14:01 UTC (rev
24061)
+++ gnunet/src/datacache/perf_datacache.c 2012-09-27 19:36:14 UTC (rev
24062)
@@ -88,9 +88,8 @@
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,
@@ -107,10 +106,9 @@
}
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",
Modified: gnunet/src/datacache/plugin_datacache_sqlite.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_sqlite.c 2012-09-27 19:14:01 UTC
(rev 24061)
+++ gnunet/src/datacache/plugin_datacache_sqlite.c 2012-09-27 19:36:14 UTC
(rev 24062)
@@ -107,10 +107,10 @@
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;
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2012-09-27 19:14:01 UTC (rev
24061)
+++ gnunet/src/hostlist/hostlist-client.c 2012-09-27 19:36:14 UTC (rev
24062)
@@ -370,10 +370,8 @@
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;
}
@@ -391,10 +389,8 @@
}
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;
}
@@ -499,10 +495,10 @@
temp = val1 + val2;
if (temp < val1)
return maxv;
- else
- return temp;
+ return temp;
}
+
/**
* Subtract val2 from val1 with underflow check
* @param val1 value 1
@@ -514,10 +510,10 @@
{
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
@@ -647,6 +643,7 @@
stat_use_bootstrap = GNUNET_YES;
}
+
/**
* Clean up the state from the task that downloaded the
* hostlist and schedule the next task.
@@ -998,6 +995,7 @@
}
}
+
/**
* Task that checks if we should try to download a hostlist.
* If so, we initiate the download, otherwise we schedule
@@ -1042,10 +1040,9 @@
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);
}
@@ -1081,12 +1078,11 @@
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);
@@ -1214,7 +1210,6 @@
}
-
/**
* Continuation called by the statistics code once
* we go the stat. Initiates hostlist download scheduling.
@@ -1238,13 +1233,14 @@
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
*/
@@ -1268,10 +1264,8 @@
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;
}
@@ -1280,7 +1274,7 @@
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;
}
@@ -1357,10 +1351,8 @@
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))
@@ -1423,6 +1415,7 @@
GNUNET_free (filename);
}
+
/**
* Start downloading hostlists from hostlist servers as necessary.
*/
@@ -1469,9 +1462,9 @@
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);
Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c 2012-09-27 19:14:01 UTC (rev
24061)
+++ gnunet/src/hostlist/hostlist-server.c 2012-09-27 19:36:14 UTC (rev
24062)
@@ -180,7 +180,7 @@
{
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;
@@ -270,7 +270,7 @@
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)
@@ -421,7 +421,7 @@
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)
Modified: gnunet/src/nat/nat.c
===================================================================
--- gnunet/src/nat/nat.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/nat/nat.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -1107,9 +1107,9 @@
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;
}
Modified: gnunet/src/util/bandwidth.c
===================================================================
--- gnunet/src/util/bandwidth.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/util/bandwidth.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -24,8 +24,7 @@
* @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__)
@@ -83,9 +82,9 @@
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;
}
Modified: gnunet/src/util/client.c
===================================================================
--- gnunet/src/util/client.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/util/client.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -27,11 +27,8 @@
* 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"
/**
@@ -955,9 +952,9 @@
(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;
@@ -1028,9 +1025,9 @@
(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);
Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/util/scheduler.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -577,10 +577,10 @@
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;
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/util/server.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -832,11 +832,9 @@
&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));
}
Modified: gnunet/src/util/test_crypto_ksk.c
===================================================================
--- gnunet/src/util/test_crypto_ksk.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/util/test_crypto_ksk.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -167,9 +167,10 @@
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
@@ -217,9 +218,9 @@
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;
}
Modified: gnunet/src/util/test_crypto_rsa.c
===================================================================
--- gnunet/src/util/test_crypto_rsa.c 2012-09-27 19:14:01 UTC (rev 24061)
+++ gnunet/src/util/test_crypto_rsa.c 2012-09-27 19:36:14 UTC (rev 24062)
@@ -81,9 +81,10 @@
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;
@@ -169,9 +170,10 @@
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;
@@ -220,9 +222,8 @@
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;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24062 - in gnunet/src: arm datacache hostlist nat util,
gnunet <=