aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core_sessions.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-20 23:22:22 +0000
committerChristian Grothoff <christian@grothoff.org>2015-03-20 23:22:22 +0000
commit802381d15888a93efe7be449e4fbbb6a463dcc24 (patch)
treea7a82824a0494220b6cd7587a635d4823c5d5538 /src/core/gnunet-service-core_sessions.c
parent74a300e03fb41b97af150ae0a2443bc3b2536746 (diff)
downloadgnunet-802381d15888a93efe7be449e4fbbb6a463dcc24.tar.gz
gnunet-802381d15888a93efe7be449e4fbbb6a463dcc24.zip
fix #3709: bound encrypted message queue
Diffstat (limited to 'src/core/gnunet-service-core_sessions.c')
-rw-r--r--src/core/gnunet-service-core_sessions.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index a16da8b7e..e4702a03a 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -35,6 +35,13 @@
35 35
36 36
37/** 37/**
38 * How many encrypted messages do we queue at most?
39 * Needed to bound memory consumption.
40 */
41#define MAX_ENCRYPTED_MESSAGE_QUEUE_SIZE 4
42
43
44/**
38 * Message ready for encryption. This struct is followed by the 45 * Message ready for encryption. This struct is followed by the
39 * actual content of the message. 46 * actual content of the message.
40 */ 47 */
@@ -639,6 +646,9 @@ try_transmission (struct Session *session)
639 min_deadline = GNUNET_TIME_UNIT_FOREVER_ABS; 646 min_deadline = GNUNET_TIME_UNIT_FOREVER_ABS;
640 /* if the peer has excess bandwidth, background traffic is allowed, 647 /* if the peer has excess bandwidth, background traffic is allowed,
641 otherwise not */ 648 otherwise not */
649 if (MAX_ENCRYPTED_MESSAGE_QUEUE_SIZE >=
650 GSC_NEIGHBOURS_check_excess_bandwidth (&session->peer))
651 return; /* queue already too long */
642 excess = GSC_NEIGHBOURS_check_excess_bandwidth (&session->peer); 652 excess = GSC_NEIGHBOURS_check_excess_bandwidth (&session->peer);
643 if (GNUNET_YES == excess) 653 if (GNUNET_YES == excess)
644 maxp = GNUNET_CORE_PRIO_BACKGROUND; 654 maxp = GNUNET_CORE_PRIO_BACKGROUND;