gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22857 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r22857 - gnunet/src/mesh
Date: Mon, 23 Jul 2012 19:35:55 +0200

Author: bartpolot
Date: 2012-07-23 19:35:55 +0200 (Mon, 23 Jul 2012)
New Revision: 22857

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/mesh/mesh_protocol.h
Log:
- message format for flow control info

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2012-07-23 16:50:52 UTC (rev 
22856)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2012-07-23 17:35:55 UTC (rev 
22857)
@@ -313,16 +313,16 @@
   int speed_min;
 
     /**
-     * Is buffering allowed in the tunnel?
+     * Is the tunnel bufferless (minimum latency)?
      */
-  int buffering;
+  int nobuffer;
 
-  /**
+    /**
      * Flag to signal the destruction of the tunnel.
      * If this is set GNUNET_YES the tunnel will be destroyed
      * when the queue is empty.
      */
-   int destroy;
+  int destroy;
 
     /**
      * Last time the tunnel was used
@@ -3265,6 +3265,7 @@
   struct MeshTunnel *t = info->t;
   struct MeshPeerPath *p = info->path;
   size_t size_needed;
+  uint32_t opt;
   int i;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CREATE PATH sending...\n");
@@ -3282,6 +3283,12 @@
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE);
   msg->tid = ntohl (t->id.tid);
 
+  if (GNUNET_YES == t->speed_min)
+    opt = MESH_TUNNEL_OPT_SPEED_MIN;
+  if (GNUNET_YES == t->nobuffer)
+    opt |= MESH_TUNNEL_OPT_NOBUFFER;
+  msg->opt = htonl(opt);
+
   peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1];
   for (i = 0; i < p->length; i++)
   {
@@ -3655,8 +3662,15 @@
   t = tunnel_get (pi, tid);
   if (NULL == t) // FIXME only for INCOMING tunnels?
   {
+    uint32_t opt;
+
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  Creating tunnel\n");
     t = tunnel_new (GNUNET_PEER_intern (pi), tid, NULL, 0);
+    opt = ntohl (msg->opt);
+    t->speed_min = (0 != (opt & MESH_TUNNEL_OPT_SPEED_MIN)) ?
+                   GNUNET_YES : GNUNET_NO;
+    t->nobuffer = (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER)) ?
+                  GNUNET_YES : GNUNET_NO;;
 
     while (NULL != tunnel_get_incoming (next_local_tid))
       next_local_tid = (next_local_tid + 1) | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
@@ -5191,14 +5205,15 @@
   switch (ntohs(message->type))
   {
       case GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_BUFFER:
-          t->buffering = GNUNET_YES;
+          t->nobuffer = GNUNET_NO;
           break;
       case GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_NOBUFFER:
-          t->buffering = GNUNET_NO;
+          t->nobuffer = GNUNET_YES;
           break;
       default:
           GNUNET_break (0);
   }
+
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 

Modified: gnunet/src/mesh/mesh_protocol.h
===================================================================
--- gnunet/src/mesh/mesh_protocol.h     2012-07-23 16:50:52 UTC (rev 22856)
+++ gnunet/src/mesh/mesh_protocol.h     2012-07-23 17:35:55 UTC (rev 22857)
@@ -35,6 +35,10 @@
 #endif
 #endif
 
+#define MESH_TUNNEL_OPT_SPEED_MIN       0x1
+#define MESH_TUNNEL_OPT_NOBUFFER        0x2
+
+
 
/******************************************************************************/
 /********************      MESH NETWORK MESSAGES     
**************************/
 
/******************************************************************************/
@@ -47,7 +51,7 @@
 struct GNUNET_MESH_ManipulatePath
 {
     /**
-     * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
+     * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DESTROY]
      *
      * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
      *       path_length * sizeof (struct GNUNET_PeerIdentity)
@@ -61,6 +65,16 @@
   uint32_t tid GNUNET_PACKED;
 
     /**
+     * Tunnel options (MESH_TUNNEL_OPT_*).
+     */
+  uint32_t opt GNUNET_PACKED;
+
+    /**
+     * 64 bit alignment padding.
+     */
+  uint32_t reserved GNUNET_PACKED;
+
+    /**
      * path_length structs defining the *whole* path from the origin [0] to the
      * final destination [path_length-1].
      */
@@ -292,38 +306,6 @@
 };
 
 
-/**
- * Message for mesh flow control
- */
-struct GNUNET_MESH_SpeedNotify
-{
-    /**
-     * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
-     */
-  struct GNUNET_MessageHeader header;
-
-    /**
-     * TID of the tunnel
-     */
-  uint32_t tid GNUNET_PACKED;
-
-    /**
-     * OID of the tunnel
-     */
-  struct GNUNET_PeerIdentity oid;
-
-    /**
-     * Is the speed limited by the slowest peer?.
-     */
-  int16_t speed_min;
-
-    /**
-     * Is the buffering allowed?.
-     */
-  int16_t buffering;
-
-};
-
 GNUNET_NETWORK_STRUCT_END
 
 #if 0                           /* keep Emacsens' auto-indent happy */




reply via email to

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