aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-23 15:44:06 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-23 15:44:06 +0100
commit5c9c418d2b7ac6cf10c577fb9c6bc687cb3b4a09 (patch)
tree774ce23929ed05d37b6d6902cfd449dc4d3c5418 /src/core
parent7c95ee4ac5390170c35894687d9d9ea24e595fd1 (diff)
downloadgnunet-5c9c418d2b7ac6cf10c577fb9c6bc687cb3b4a09.tar.gz
gnunet-5c9c418d2b7ac6cf10c577fb9c6bc687cb3b4a09.zip
limit queue size CORE maintains for any client, warn if we exceed it
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 52c6f72ab..6a126e6dd 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -32,11 +32,11 @@
32#include "gnunet-service-core_typemap.h" 32#include "gnunet-service-core_typemap.h"
33 33
34/** 34/**
35 * How many messages do we queue up at most for optional 35 * How many messages do we queue up at most for any client? This can
36 * notifications to a client? (this can cause notifications 36 * cause messages to be dropped if clients do not process them fast
37 * about outgoing messages to be dropped). 37 * enough!
38 */ 38 */
39#define MAX_NOTIFY_QUEUE 1024 39#define MAX_QUEUE 128
40 40
41 41
42/** 42/**
@@ -834,6 +834,24 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
834 if ( (0 != (options & GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND)) && 834 if ( (0 != (options & GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND)) &&
835 (0 != (c->options & GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND)) ) 835 (0 != (c->options & GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND)) )
836 continue; 836 continue;
837 if (MAX_QUEUE < GNUNET_MQ_get_length (c->mq))
838 {
839 char buf[1024];
840
841 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
842 "Dropping decrypted message of type %u as client is too busy (queue full)\n",
843 (unsigned int) ntohs (msg->type));
844 GNUNET_snprintf (buf,
845 sizeof (buf),
846 gettext_noop ("# messages of type %u discarded (client busy)"),
847 (unsigned int) ntohs (msg->type));
848 GNUNET_STATISTICS_update (GSC_stats,
849 buf,
850 1,
851 GNUNET_NO);
852 continue;
853 }
854
837 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 855 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
838 "Sending %u message with %u bytes to client interested in messages of type %u.\n", 856 "Sending %u message with %u bytes to client interested in messages of type %u.\n",
839 options, 857 options,