gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22809 - gnunet/src/mesh
Date: Fri, 20 Jul 2012 19:59:58 +0200

Author: bartpolot
Date: 2012-07-20 19:59:58 +0200 (Fri, 20 Jul 2012)
New Revision: 22809

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/mesh/mesh_protocol.h
Log:
- fixes, new message

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2012-07-20 17:46:04 UTC (rev 
22808)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2012-07-20 17:59:58 UTC (rev 
22809)
@@ -1966,6 +1966,13 @@
   info->mesh_data = GNUNET_malloc (sizeof (struct MeshData));
   info->mesh_data->data = GNUNET_malloc (size);
   memcpy (info->mesh_data->data, message, size);
+  if (ntohs(message->type) == GNUNET_MESSAGE_TYPE_MESH_UNICAST)
+  {
+    struct GNUNET_MESH_Unicast *m;
+
+    m = (struct GNUNET_MESH_Unicast *) info->mesh_data->data;
+    m->ttl--;
+  }
   info->mesh_data->data_len = size;
   info->mesh_data->reference_counter = GNUNET_malloc (sizeof (unsigned int));
   *info->mesh_data->reference_counter = 1;
@@ -3958,7 +3965,8 @@
 {
   struct GNUNET_MESH_Unicast *msg;
   struct MeshTunnel *t;
-  GNUNET_PEER_Id pid;
+  uint32_t pid;
+  uint32_t ttl;
   size_t size;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got a unicast packet from %s\n",
@@ -4005,6 +4013,14 @@
     send_subscribed_clients (message, (struct GNUNET_MessageHeader *) &msg[1]);
     return GNUNET_OK;
   }
+  ttl = ntohl (msg->ttl);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "   ttl: %u\n", ttl);
+  if (ttl == 0)
+  {
+    /* FIXME: ttl is 0, log dropping */
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n");
+    return GNUNET_OK;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "  not for us, retransmitting...\n");
   send_message (message, tree_get_first_hop (t->tree, pid), t);

Modified: gnunet/src/mesh/mesh_protocol.h
===================================================================
--- gnunet/src/mesh/mesh_protocol.h     2012-07-20 17:46:04 UTC (rev 22808)
+++ gnunet/src/mesh/mesh_protocol.h     2012-07-20 17:59:58 UTC (rev 22809)
@@ -176,6 +176,36 @@
 
 
 /**
+ * Message to acknowledte mesh data traffic.
+ */
+struct GNUNET_MESH_ACK
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
+     */
+  struct GNUNET_MessageHeader header;
+
+    /**
+     * TID of the tunnel
+     */
+  uint32_t tid GNUNET_PACKED;
+
+    /**
+     * OID of the tunnel
+     */
+  struct GNUNET_PeerIdentity oid;
+
+    /**
+     * Sender of the message.
+     */
+  struct GNUNET_PeerIdentity sender;
+
+    /**
+     * Payload follows
+     */
+};
+
+/**
  * Message for ack'ing a path
  */
 struct GNUNET_MESH_PathACK




reply via email to

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