From: Christian Grothoff Date: Mon, 6 Jun 2011 11:52:54 +0000 (+0000) Subject: disable warning if we intentionally throttle a connection X-Git-Tag: initial-import-from-subversion-38251~18314 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=974cf0e80d8b65d459aa9cf15448184e657d3e39;p=oweals%2Fgnunet.git disable warning if we intentionally throttle a connection --- diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index a0097589b..ca2041984 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h @@ -226,6 +226,16 @@ GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); void GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success); +/** + * Disable the warning the server issues if a message is not acknowledged + * in a timely fashion. Use this call if a client is intentionally delayed + * for a while. Only applies to the current message. + * + * @param client client for which to disable the warning + */ +void +GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client *client); + /** * Inject a message into the server, pretend it came diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index b34c0305a..5826adfec 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -5474,8 +5474,8 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); if (ret.rel_value > 0) { -#if DEBUG_TRANSPORT || 1 - GNUNET_log (GNUNET_ERROR_TYPE_INFO, +#if DEBUG_TRANSPORT + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n", (unsigned long long) n->in_tracker.consumption_since_last_update__, (unsigned int) n->in_tracker.available_bytes_per_s__, @@ -5778,8 +5778,8 @@ handle_set_quota (void *cls, GNUNET_NO); return; } -#if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, +#if DEBUG_TRANSPORT || 1 + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Received `%s' request (new quota %u, old quota %u) from client for peer `%4s'\n", "SET_QUOTA", (unsigned int) ntohl (qsm->quota.value__), diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 8d1f90590..1c22ce806 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -2106,13 +2106,14 @@ handle_tcp_data (void *cls, } else { -#if DEBUG_TCP || 1 - GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, +#if DEBUG_TCP + GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", "Throttling receiving from `%s' for %llu ms\n", GNUNET_i2s (&session->target), (unsigned long long) delay.rel_value); #endif + GNUNET_SERVER_disable_receive_done_warning (client); session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); } diff --git a/src/util/server.c b/src/util/server.c index 63131bb85..738f86216 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -598,6 +598,24 @@ warn_no_receive_done (void *cls, } +/** + * Disable the warning the server issues if a message is not acknowledged + * in a timely fashion. Use this call if a client is intentionally delayed + * for a while. Only applies to the current message. + * + * @param client client for which to disable the warning + */ +void +GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client *client) +{ + if (GNUNET_SCHEDULER_NO_TASK != client->warn_task) + { + GNUNET_SCHEDULER_cancel (client->warn_task); + client->warn_task = GNUNET_SCHEDULER_NO_TASK; + } +} + + /** * Inject a message into the server, pretend it came * from the specified client. Delivery of the message