gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27630 - gnunet/src/mesh
Date: Wed, 26 Jun 2013 17:16:39 +0200

Author: bartpolot
Date: 2013-06-26 17:16:39 +0200 (Wed, 26 Jun 2013)
New Revision: 27630

Modified:
   gnunet/src/mesh/mesh2_api.c
Log:
- fixed 2906

Modified: gnunet/src/mesh/mesh2_api.c
===================================================================
--- gnunet/src/mesh/mesh2_api.c 2013-06-26 13:38:12 UTC (rev 27629)
+++ gnunet/src/mesh/mesh2_api.c 2013-06-26 15:16:39 UTC (rev 27630)
@@ -1196,7 +1196,7 @@
     t = th->tunnel;
     if (GNUNET_YES == th_is_payload (th))
     {
-      struct GNUNET_MESH_Data dmsg;
+      struct GNUNET_MESH_Data *dmsg;
       struct GNUNET_MessageHeader *mh;
 
       LOG (GNUNET_ERROR_TYPE_DEBUG, "#  payload\n");
@@ -1208,29 +1208,31 @@
       }
       t->packet_size = 0;
       GNUNET_assert (size >= th->size);
-      mh = (struct GNUNET_MessageHeader *) &cbuf[sizeof (dmsg)];
-      psize = th->notify (th->notify_cls, size - sizeof (dmsg), mh);
+      dmsg = (struct GNUNET_MESH_Data *) cbuf;
+      mh = (struct GNUNET_MessageHeader *) &dmsg[1];
+      psize = th->notify (th->notify_cls,
+                          size - sizeof (struct GNUNET_MESH_Data),
+                          mh);
       if (psize > 0)
       {
-        psize += sizeof (dmsg);
+        psize += sizeof (struct GNUNET_MESH_Data);
         GNUNET_assert (size >= psize);
-        dmsg.header.size = htons (psize);
-        dmsg.tid = htonl (t->tid);
-        dmsg.pid = htonl (t->last_pid_sent + 1);
-        dmsg.ttl = 0;
-        memset (&dmsg.oid, 0, sizeof (struct GNUNET_PeerIdentity));
-        memcpy (cbuf, &dmsg, sizeof (dmsg));
+        dmsg->header.size = htons (psize);
+        dmsg->tid = htonl (t->tid);
+        dmsg->pid = htonl (t->last_pid_sent + 1);
+        dmsg->ttl = 0;
+        memset (&dmsg->oid, 0, sizeof (struct GNUNET_PeerIdentity));
         t->last_pid_sent++;
       }
       if (t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV)
       {
-        dmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
+        dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
         LOG (GNUNET_ERROR_TYPE_DEBUG, "#  to origin, type %s\n",
              GNUNET_MESH_DEBUG_M2S (ntohs (mh->type)));
       }
       else
       {
-        dmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_UNICAST);
+        dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_UNICAST);
         LOG (GNUNET_ERROR_TYPE_DEBUG, "#  unicast, type %s\n",
              GNUNET_MESH_DEBUG_M2S (ntohs (mh->type)));
       }




reply via email to

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