gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17194 - in gnunet/src: mesh vpn


From: gnunet
Subject: [GNUnet-SVN] r17194 - in gnunet/src: mesh vpn
Date: Wed, 5 Oct 2011 11:41:31 +0200

Author: toelke
Date: 2011-10-05 11:41:31 +0200 (Wed, 05 Oct 2011)
New Revision: 17194

Modified:
   gnunet/src/mesh/mesh_api.c
   gnunet/src/vpn/gnunet-daemon-vpn.c
Log:
core gives a buf of NULL to indicate errors

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2011-10-05 08:58:50 UTC (rev 17193)
+++ gnunet/src/mesh/mesh_api.c  2011-10-05 09:41:31 UTC (rev 17194)
@@ -675,6 +675,9 @@
   struct notify_cls *ncls = cls;
   struct GNUNET_MESH_Tunnel *tunnel = ncls->tunnel;
 
+  if (NULL == buf)
+    return ncls->notify (ncls->notify_cls, 0, NULL);
+
   tunnel->notify_handle = NULL;
   struct tunnel_message *message = buf;
   void *cbuf = (void *) &message[1];

Modified: gnunet/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn.c  2011-10-05 08:58:50 UTC (rev 17193)
+++ gnunet/src/vpn/gnunet-daemon-vpn.c  2011-10-05 09:41:31 UTC (rev 17194)
@@ -283,16 +283,22 @@
   struct GNUNET_MESH_Tunnel **tunnel = cls;
 
   GNUNET_MESH_tunnel_set_data (*tunnel, NULL);
-  struct GNUNET_MessageHeader *hdr =
-      (struct GNUNET_MessageHeader *) (tunnel + 1);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "send_pkt_to_peer_notify_callback: buf = %x; size = %u;\n", buf,
-              size);
-  GNUNET_assert (size >= ntohs (hdr->size));
-  memcpy (buf, hdr, ntohs (hdr->size));
-  size = ntohs (hdr->size);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent!\n");
 
+  if (NULL != buf)
+    {
+      struct GNUNET_MessageHeader *hdr =
+        (struct GNUNET_MessageHeader *) (tunnel + 1);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "send_pkt_to_peer_notify_callback: buf = %x; size = %u;\n", 
buf,
+                  size);
+      GNUNET_assert (size >= ntohs (hdr->size));
+      memcpy (buf, hdr, ntohs (hdr->size));
+      size = ntohs (hdr->size);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent!\n");
+    }
+  else
+    size = 0;
+
   if (NULL != GNUNET_MESH_tunnel_get_head (*tunnel))
   {
     struct tunnel_notify_queue *element = GNUNET_MESH_tunnel_get_head 
(*tunnel);




reply via email to

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