From 24dc41dd58c67b53829888c21bbcaffc7cab5a05 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 31 Jan 2017 17:45:25 +0100 Subject: [PATCH] implement no-buffer option at route level --- src/cadet/gnunet-service-cadet-new_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c index 70d0cb83e..ee05a2442 100644 --- a/src/cadet/gnunet-service-cadet-new_core.c +++ b/src/cadet/gnunet-service-cadet-new_core.c @@ -27,7 +27,6 @@ * All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom)) * * TODO: - * - do NOT use buffering if the route options say no buffer! * - Optimization: given BROKEN messages, destroy paths (?) */ #include "platform.h" @@ -394,6 +393,12 @@ route_message (struct CadetPeer *prev, GNUNET_MQ_msg_copy (msg)); return; } + /* Check if buffering is disallowed, and if so, make sure we only queue + one message per direction. */ + if ( (0 != (route->options & GNUNET_CADET_OPTION_NOBUFFER)) && + (NULL != dir->env_head) ) + discard_buffer (dir, + dir->env_head); rung = dir->rung; if (cur_buffers == max_buffers) { -- 2.25.1