From: Christian Grothoff Date: Thu, 8 Oct 2015 16:20:42 +0000 (+0000) Subject: add constant for the delay after which we log warnings X-Git-Tag: initial-import-from-subversion-38251~1286 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7e0c1c4306fd99d56320767809d67192a59f8ab9;p=oweals%2Fgnunet.git add constant for the delay after which we log warnings --- diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index 073130e6d..b0a72c53a 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h @@ -71,6 +71,11 @@ extern "C" */ #define GNUNET_CONSTANTS_MAX_CORK_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) +/** + * After what amount of latency for a message do we print a warning? + */ +#define GNUNET_CONSTANTS_LATENCY_WARN GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) + /** * Until which load do we consider the peer overly idle * (which means that we would like to use more resources).

diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index e3477f57c..47bdef88e 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -976,7 +976,7 @@ transport_notify_ready (void *cls, size, &cbuf[ret]); delay = GNUNET_TIME_absolute_get_duration (th->request_start); - if (delay.rel_value_us > 1000 * 1000) + if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) LOG (GNUNET_ERROR_TYPE_WARNING, "Added %u bytes of control message at %u after %s delay\n", nret, @@ -1055,7 +1055,7 @@ transport_notify_ready (void *cls, GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker, mret); delay = GNUNET_TIME_absolute_get_duration (th->request_start); - if (delay.rel_value_us > 1000 * 1000) + if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) LOG (GNUNET_ERROR_TYPE_WARNING, "Added %u bytes of payload message for %s after %s delay at %u b/s\n", mret, @@ -2058,7 +2058,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, n->traffic_overhead = 0; if (delay.rel_value_us > timeout.rel_value_us) delay.rel_value_us = 0; /* notify immediately (with failure) */ - if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us) + if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) LOG (GNUNET_ERROR_TYPE_WARNING, "At bandwidth %u byte/s next transmission to %s in %s\n", (unsigned int) n->out_tracker.available_bytes_per_s__,