aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet-new_core.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-29 18:43:35 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-29 18:43:35 +0100
commit81f9e9e971e615e9f1f18d1509168b56bb7360c0 (patch)
tree84bf2b1e3240ee9190bf1ea7f2dfca63c19dafe1 /src/cadet/gnunet-service-cadet-new_core.c
parentdc430a9d23f8fd76f700d6836d4f4748429d70cd (diff)
downloadgnunet-81f9e9e971e615e9f1f18d1509168b56bb7360c0.tar.gz
gnunet-81f9e9e971e615e9f1f18d1509168b56bb7360c0.zip
introduce buffering options on the route level
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_core.c')
-rw-r--r--src/cadet/gnunet-service-cadet-new_core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c
index 25ffcb3ce..75a94119c 100644
--- a/src/cadet/gnunet-service-cadet-new_core.c
+++ b/src/cadet/gnunet-service-cadet-new_core.c
@@ -28,6 +28,7 @@
28 * 28 *
29 * TODO: 29 * TODO:
30 * - properly implement GLOBAL message buffer, instead of per-route buffers 30 * - properly implement GLOBAL message buffer, instead of per-route buffers
31 * - do NOT use buffering if the route options say no buffer!
31 * - Optimization: given BROKEN messages, destroy paths (?) 32 * - Optimization: given BROKEN messages, destroy paths (?)
32 */ 33 */
33#include "platform.h" 34#include "platform.h"
@@ -128,6 +129,11 @@ struct CadetRoute
128 * Position of this route in the #route_heap. 129 * Position of this route in the #route_heap.
129 */ 130 */
130 struct GNUNET_CONTAINER_HeapNode *hn; 131 struct GNUNET_CONTAINER_HeapNode *hn;
132
133 /**
134 * Options for the route, control buffering.
135 */
136 enum GNUNET_CADET_ChannelOption options;
131}; 137};
132 138
133 139
@@ -521,7 +527,9 @@ handle_connection_create (void *cls,
521 uint16_t size = ntohs (msg->header.size) - sizeof (*msg); 527 uint16_t size = ntohs (msg->header.size) - sizeof (*msg);
522 unsigned int path_length; 528 unsigned int path_length;
523 unsigned int off; 529 unsigned int off;
530 enum GNUNET_CADET_ChannelOption options;
524 531
532 options = (enum GNUNET_CADET_ChannelOption) ntohl (msg->options);
525 path_length = size / sizeof (struct GNUNET_PeerIdentity); 533 path_length = size / sizeof (struct GNUNET_PeerIdentity);
526 /* Initiator is at offset 0. */ 534 /* Initiator is at offset 0. */
527 for (off=1;off<path_length;off++) 535 for (off=1;off<path_length;off++)
@@ -585,6 +593,7 @@ handle_connection_create (void *cls,
585 GCT_add_inbound_connection (GCP_get_tunnel (origin, 593 GCT_add_inbound_connection (GCP_get_tunnel (origin,
586 GNUNET_YES), 594 GNUNET_YES),
587 &msg->cid, 595 &msg->cid,
596 (enum GNUNET_CADET_ChannelOption) ntohl (msg->options),
588 path)) 597 path))
589 { 598 {
590 /* Send back BROKEN: duplicate connection on the same path, 599 /* Send back BROKEN: duplicate connection on the same path,
@@ -639,6 +648,7 @@ handle_connection_create (void *cls,
639 GNUNET_i2s (&pids[off + 1]), 648 GNUNET_i2s (&pids[off + 1]),
640 off + 1); 649 off + 1);
641 route = GNUNET_new (struct CadetRoute); 650 route = GNUNET_new (struct CadetRoute);
651 route->options = options;
642 route->cid = msg->cid; 652 route->cid = msg->cid;
643 route->last_use = GNUNET_TIME_absolute_get (); 653 route->last_use = GNUNET_TIME_absolute_get ();
644 dir_init (&route->prev, 654 dir_init (&route->prev,