gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31334 - gnunet/src/mesh
Date: Thu, 12 Dec 2013 19:47:47 +0100

Author: bartpolot
Date: 2013-12-12 19:47:47 +0100 (Thu, 12 Dec 2013)
New Revision: 31334

Modified:
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- return NULL when continuation is NULL, avoid channel:860 break


Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-12-12 18:38:31 UTC 
(rev 31333)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-12-12 18:47:47 UTC 
(rev 31334)
@@ -656,7 +656,7 @@
 static struct MeshTunnelDelayed *
 queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg)
 {
-  struct MeshTunnelDelayed *tq;
+  struct MeshTunnelDelayed *tqd;
   uint16_t size = ntohs (msg->size);
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GMT_2s (t));
@@ -667,12 +667,12 @@
     return NULL;
   }
 
-  tq = GNUNET_malloc (sizeof (struct MeshTunnelDelayed) + size);
+  tqd = GNUNET_malloc (sizeof (struct MeshTunnelDelayed) + size);
 
-  tq->t = t;
-  memcpy (&tq[1], msg, size);
-  GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq);
-  return tq;
+  tqd->t = t;
+  memcpy (&tqd[1], msg, size);
+  GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tqd);
+  return tqd;
 }
 
 
@@ -711,10 +711,17 @@
 
   if (GNUNET_NO == is_ready (t))
   {
+    struct MeshTunnelDelayed *tqd;
+    /* A non null existing_q indicates sending of queued data.
+     * Should only happen after tunnel becomes ready.
+     */
     GNUNET_assert (NULL == existing_q);
+    tqd = queue_data (t, message);
+    if (NULL == cont)
+      return NULL;
     tq = GNUNET_new (struct MeshTunnel3Queue);
-    tq->tqd = queue_data (t, message);
-    tq->tqd->tq = tq;
+    tq->tqd = tqd;
+    tqd->tq = tq;
     tq->cont = cont;
     tq->cont_cls = cont_cls;
     return tq;
@@ -814,8 +821,10 @@
     next = tqd->next;
     room--;
     send_prebuilt_message ((struct GNUNET_MessageHeader *) &tqd[1],
-                               tqd->t, GNUNET_YES,
-                           tqd->tq->cont, tqd->tq->cont_cls, tqd->tq);
+                           tqd->t, GNUNET_YES,
+                           NULL != tqd->tq ? tqd->tq->cont : NULL,
+                           NULL != tqd->tq ? tqd->tq->cont_cls : NULL,
+                           tqd->tq);
     unqueue_data (tqd);
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_send_queued_data end\n", GMP_2s 
(t->peer));




reply via email to

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