gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: introduce buffering options


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: introduce buffering options on the route level
Date: Sun, 29 Jan 2017 18:43:38 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 81f9e9e97 introduce buffering options on the route level
81f9e9e97 is described below

commit 81f9e9e971e615e9f1f18d1509168b56bb7360c0
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 29 18:43:35 2017 +0100

    introduce buffering options on the route level
---
 src/cadet/cadet_protocol.h                      |  7 +++++--
 src/cadet/gnunet-service-cadet-new_connection.c | 15 +++++++++++++++
 src/cadet/gnunet-service-cadet-new_connection.h |  4 ++++
 src/cadet/gnunet-service-cadet-new_core.c       | 10 ++++++++++
 src/cadet/gnunet-service-cadet-new_tunnels.c    |  4 ++++
 src/cadet/gnunet-service-cadet-new_tunnels.h    |  2 ++
 src/cadet/gnunet-service-cadet_connection.c     |  2 +-
 7 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h
index e2d6f9d0b..d2426addb 100644
--- a/src/cadet/cadet_protocol.h
+++ b/src/cadet/cadet_protocol.h
@@ -67,9 +67,12 @@ struct GNUNET_CADET_ConnectionCreateMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * For alignment.
+   * Connection options in network byte order.
+   * #GNUNET_CADET_OPTION_DEFAULT for buffered;
+   * #GNUNET_CADET_OPTION_NOBUFFER for unbuffered.
+   * Other flags are ignored and should not be set at this level.
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint32_t options GNUNET_PACKED;
 
   /**
    * ID of the connection
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c 
b/src/cadet/gnunet-service-cadet-new_connection.c
index fdc6de620..13d4c4a0c 100644
--- a/src/cadet/gnunet-service-cadet-new_connection.c
+++ b/src/cadet/gnunet-service-cadet-new_connection.c
@@ -146,6 +146,11 @@ struct CadetConnection
   enum CadetConnectionState state;
 
   /**
+   * Options for the route, control buffering.
+   */
+  enum GNUNET_CADET_ChannelOption options;
+
+  /**
    * Offset of our @e destination in @e path.
    */
   unsigned int off;
@@ -490,6 +495,7 @@ send_create (void *cls)
   env = GNUNET_MQ_msg_extra (create_msg,
                              (1 + path_length) * sizeof (struct 
GNUNET_PeerIdentity),
                              GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE);
+  create_msg->options = htonl ((uint32_t) cc->options);
   create_msg->cid = cc->cid;
   pids = (struct GNUNET_PeerIdentity *) &create_msg[1];
   pids[0] = my_full_id;
@@ -666,6 +672,7 @@ manage_first_hop_mq (void *cls,
  *
  * @param destination where to go
  * @param path which path to take (may not be the full path)
+ * @param options options for the connection
  * @param ct which tunnel uses this connection
  * @param init_state initial state for the connection
  * @param ready_cb function to call when ready to transmit
@@ -675,6 +682,7 @@ manage_first_hop_mq (void *cls,
 static struct CadetConnection *
 connection_create (struct CadetPeer *destination,
                    struct CadetPeerPath *path,
+                   enum GNUNET_CADET_ChannelOption options,
                    struct CadetTConnection *ct,
                    const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
                    enum CadetConnectionState init_state,
@@ -689,6 +697,7 @@ connection_create (struct CadetPeer *destination,
                         destination);
   GNUNET_assert (UINT_MAX > off);
   cc = GNUNET_new (struct CadetConnection);
+  cc->options = options;
   cc->state = init_state;
   cc->ct = ct;
   cc->cid = *cid;
@@ -729,6 +738,7 @@ connection_create (struct CadetPeer *destination,
  *
  * @param destination where to go
  * @param path which path to take (may not be the full path)
+ * @param options options for the connection
  * @param ct which tunnel uses this connection
  * @param ready_cb function to call when ready to transmit
  * @param ready_cb_cls closure for @a cb
@@ -738,6 +748,7 @@ connection_create (struct CadetPeer *destination,
 struct CadetConnection *
 GCC_create_inbound (struct CadetPeer *destination,
                     struct CadetPeerPath *path,
+                   enum GNUNET_CADET_ChannelOption options,
                     struct CadetTConnection *ct,
                     const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
                     GCC_ReadyCallback ready_cb,
@@ -793,6 +804,7 @@ GCC_create_inbound (struct CadetPeer *destination,
 
   return connection_create (destination,
                             path,
+                            options,
                             ct,
                             cid,
                             CADET_CONNECTION_CREATE_RECEIVED,
@@ -807,6 +819,7 @@ GCC_create_inbound (struct CadetPeer *destination,
  *
  * @param destination where to go
  * @param path which path to take (may not be the full path)
+ * @param options options for the connection
  * @param ct tunnel that uses the connection
  * @param ready_cb function to call when ready to transmit
  * @param ready_cb_cls closure for @a cb
@@ -815,6 +828,7 @@ GCC_create_inbound (struct CadetPeer *destination,
 struct CadetConnection *
 GCC_create (struct CadetPeer *destination,
             struct CadetPeerPath *path,
+            enum GNUNET_CADET_ChannelOption options,
             struct CadetTConnection *ct,
             GCC_ReadyCallback ready_cb,
             void *ready_cb_cls)
@@ -826,6 +840,7 @@ GCC_create (struct CadetPeer *destination,
                               sizeof (cid));
   return connection_create (destination,
                             path,
+                            options,
                             ct,
                             &cid,
                             CADET_CONNECTION_NEW,
diff --git a/src/cadet/gnunet-service-cadet-new_connection.h 
b/src/cadet/gnunet-service-cadet-new_connection.h
index cea1e8024..1302b0060 100644
--- a/src/cadet/gnunet-service-cadet-new_connection.h
+++ b/src/cadet/gnunet-service-cadet-new_connection.h
@@ -75,6 +75,7 @@ GCC_destroy_without_tunnel (struct CadetConnection *cc);
  *
  * @param destination where to go
  * @param path which path to take (may not be the full path)
+ * @param options options for the connection
  * @param ct which tunnel uses this connection
  * @param ready_cb function to call when ready to transmit
  * @param ready_cb_cls closure for @a cb
@@ -83,6 +84,7 @@ GCC_destroy_without_tunnel (struct CadetConnection *cc);
 struct CadetConnection *
 GCC_create (struct CadetPeer *destination,
             struct CadetPeerPath *path,
+            enum GNUNET_CADET_ChannelOption options,
             struct CadetTConnection *ct,
             GCC_ReadyCallback ready_cb,
             void *ready_cb_cls);
@@ -95,6 +97,7 @@ GCC_create (struct CadetPeer *destination,
  *
  * @param destination where to go
  * @param path which path to take (may not be the full path)
+ * @param options options for the connection
  * @param ct which tunnel uses this connection
  * @param ready_cb function to call when ready to transmit
  * @param ready_cb_cls closure for @a cb
@@ -104,6 +107,7 @@ GCC_create (struct CadetPeer *destination,
 struct CadetConnection *
 GCC_create_inbound (struct CadetPeer *destination,
                     struct CadetPeerPath *path,
+                    enum GNUNET_CADET_ChannelOption options,
                     struct CadetTConnection *ct,
                     const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
                     GCC_ReadyCallback ready_cb,
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 @@
  *
  * TODO:
  * - properly implement GLOBAL message buffer, instead of per-route buffers
+ * - do NOT use buffering if the route options say no buffer!
  * - Optimization: given BROKEN messages, destroy paths (?)
  */
 #include "platform.h"
@@ -128,6 +129,11 @@ struct CadetRoute
    * Position of this route in the #route_heap.
    */
   struct GNUNET_CONTAINER_HeapNode *hn;
+
+  /**
+   * Options for the route, control buffering.
+   */
+  enum GNUNET_CADET_ChannelOption options;
 };
 
 
@@ -521,7 +527,9 @@ handle_connection_create (void *cls,
   uint16_t size = ntohs (msg->header.size) - sizeof (*msg);
   unsigned int path_length;
   unsigned int off;
+  enum GNUNET_CADET_ChannelOption options;
 
+  options = (enum GNUNET_CADET_ChannelOption) ntohl (msg->options);
   path_length = size / sizeof (struct GNUNET_PeerIdentity);
   /* Initiator is at offset 0. */
   for (off=1;off<path_length;off++)
@@ -585,6 +593,7 @@ handle_connection_create (void *cls,
         GCT_add_inbound_connection (GCP_get_tunnel (origin,
                                                     GNUNET_YES),
                                     &msg->cid,
+                                    (enum GNUNET_CADET_ChannelOption) ntohl 
(msg->options),
                                     path))
     {
       /* Send back BROKEN: duplicate connection on the same path,
@@ -639,6 +648,7 @@ handle_connection_create (void *cls,
        GNUNET_i2s (&pids[off + 1]),
        off + 1);
   route = GNUNET_new (struct CadetRoute);
+  route->options = options;
   route->cid = msg->cid;
   route->last_use = GNUNET_TIME_absolute_get ();
   dir_init (&route->prev,
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c 
b/src/cadet/gnunet-service-cadet-new_tunnels.c
index 3c0271c71..e41164220 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -2444,6 +2444,7 @@ consider_path_cb (void *cls,
   ct->t = t;
   ct->cc = GCC_create (t->destination,
                        path,
+                       GNUNET_CADET_OPTION_DEFAULT, /* FIXME: set based on 
what channels want/need! */
                        ct,
                        &connection_ready_cb,
                        ct);
@@ -2888,6 +2889,7 @@ GCT_create_tunnel (struct CadetPeer *destination)
  *
  * @param t a tunnel
  * @param cid connection identifer to use for the connection
+ * @param options options for the connection
  * @param path path to use for the connection
  * @return #GNUNET_OK on success,
  *         #GNUNET_SYSERR on failure (duplicate connection)
@@ -2895,6 +2897,7 @@ GCT_create_tunnel (struct CadetPeer *destination)
 int
 GCT_add_inbound_connection (struct CadetTunnel *t,
                             const struct 
GNUNET_CADET_ConnectionTunnelIdentifier *cid,
+                            enum GNUNET_CADET_ChannelOption options,
                             struct CadetPeerPath *path)
 {
   struct CadetTConnection *ct;
@@ -2904,6 +2907,7 @@ GCT_add_inbound_connection (struct CadetTunnel *t,
   ct->t = t;
   ct->cc = GCC_create_inbound (t->destination,
                                path,
+                               options,
                                ct,
                                cid,
                                &connection_ready_cb,
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.h 
b/src/cadet/gnunet-service-cadet-new_tunnels.h
index d18abeb3c..f8613d236 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.h
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.h
@@ -119,6 +119,7 @@ GCT_destroy_tunnel_now (struct CadetTunnel *t);
  *
  * @param t a tunnel
  * @param cid connection identifer to use for the connection
+ * @param options options for the connection
  * @param path path to use for the connection
  * @return #GNUNET_OK on success,
  *         #GNUNET_SYSERR on failure (duplicate connection)
@@ -126,6 +127,7 @@ GCT_destroy_tunnel_now (struct CadetTunnel *t);
 int
 GCT_add_inbound_connection (struct CadetTunnel *t,
                             const struct 
GNUNET_CADET_ConnectionTunnelIdentifier *cid,
+                            enum GNUNET_CADET_ChannelOption options,
                             struct CadetPeerPath *path);
 
 
diff --git a/src/cadet/gnunet-service-cadet_connection.c 
b/src/cadet/gnunet-service-cadet_connection.c
index af27647b3..2d5087f81 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -3425,7 +3425,7 @@ GCC_send_create (struct CadetConnection *c)
     msg = (struct GNUNET_CADET_ConnectionCreateMessage *) cbuf;
     msg->header.size = htons (size);
     msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE);
-    msg->reserved = htonl (0);
+    msg->options = htonl (0);
     msg->cid = *GCC_get_id (c);
     peers = (struct GNUNET_PeerIdentity *) &msg[1];
     for (int i = 0; i < c->path->length; i++)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]