disable warning if we intentionally throttle a connection
authorChristian Grothoff <christian@grothoff.org>
Mon, 6 Jun 2011 11:52:54 +0000 (11:52 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 6 Jun 2011 11:52:54 +0000 (11:52 +0000)
src/include/gnunet_server_lib.h
src/transport/gnunet-service-transport.c
src/transport/plugin_transport_tcp.c
src/util/server.c

index a0097589b5089df6c6b289c026da566822f254dd..ca2041984dc71654d93d870a1dd62110af77abcc 100644 (file)
@@ -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
index b34c0305a3fb99a42b810de43407b526eaab4e81..5826adfecbd22872fa7ed64cde2c0678c9c378ad 100644 (file)
@@ -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__),
index 8d1f905901c60d17155f068b5335f4c4f977ec0d..1c22ce806541580b75e440826dc0f43788aac2ea 100644 (file)
@@ -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);
     }
index 63131bb85ab3a76db7df6cec0d68d288b1b9e975..738f86216681b0587eac8363f20dcbe67c3e54f7 100644 (file)
@@ -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