gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14974 - gnunet/src/mesh
Date: Wed, 13 Apr 2011 17:48:05 +0200

Author: bartpolot
Date: 2011-04-13 17:48:05 +0200 (Wed, 13 Apr 2011)
New Revision: 14974

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
WiP


Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-04-13 12:12:12 UTC (rev 
14973)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-04-13 15:48:05 UTC (rev 
14974)
@@ -267,6 +267,7 @@
      */
     struct Path                 *next;
     struct Path                 *prev;
+
     /**
      * Id of the path, in case it's needed
      */
@@ -283,7 +284,31 @@
     GNUNET_PEER_Id              *peers;
 };
 
+struct MESH_queue
+{
+    /**
+     * Double linked list
+     */
+    struct MESH_queue          *next;
+    struct MESH_queue          *prev;
 
+    /**
+     * Size of the message to transmit
+     */
+    unsigned int                size;
+    
+    /**
+     * How old is the data?
+     */
+    struct GNUNET_TIME_Absolute timestamp;
+    
+    /**
+     * Data itself
+     */
+    struct GNUNET_MessageHeader *data;
+};
+
+
 struct Client; /* FWD declaration */
 /**
  * Struct containing all information regarding a tunnel
@@ -356,14 +381,16 @@
     struct Client               *client;
 
     /**
-     * Messages ready to transmit??? -- FIXME real queues needed
+     * Messages ready to transmit
      */
-    struct GNUNET_MessageHeader *msg_out;
+    struct MESH_queue           *out_head;
+    struct MESH_queue           *out_tail;
 
     /**
-     * Messages received and not processed??? -- FIXME real queues needed
+     * Messages received and not processed
      */
-    struct GNUNET_MessageHeader *msg_in;
+    struct MESH_queue           *in_head;
+    struct MESH_queue           *in_tail;
 
 };
 
@@ -637,18 +664,28 @@
         }
     /* Sanity check for duplicate tunnel IDs */
     for (t = tunnels_head; t != tunnels_head; t = t->next) {
-        /* TODO - maybe this is not enough, need to consider the whole
-         * local/global numbering system, but probably it's ok (WiP)
-         */
-        if(t->tid == tunnel_msg->tunnel_id) {
+        if(t->tid == ntohl(tunnel_msg->tunnel_id)) {
             GNUNET_break(0);
             GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
             return;
         }
     }
-    //tunnel_msg->tunnel_id;
+    /* FIXME: calloc? is NULL != 0 on any platform? */
+    t = GNUNET_malloc(sizeof(MESH_tunnel));
+    t->tid = ntohl(tunnel_msg->tunnel_id);
+    /* FIXME: t->oid = selfid;*/
+    t->peers_ready = 0;
+    t->peers_total = 0;
+    t->peers_head = NULL;
+    t->peers_tail = NULL;
+    t->paths_head = NULL;
+    t->paths_tail = NULL;
+    t->in_head = NULL;
+    t->in_tail = NULL;
+    t->out_head = NULL;
+    t->out_tail = NULL;
     
-    
+    GNUNET_SERVER_receive_done(client, GNUNET_OK);
     return;
 }
 




reply via email to

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