tolerate empty message
authorChristian Grothoff <christian@grothoff.org>
Sat, 31 Oct 2009 20:43:41 +0000 (20:43 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 31 Oct 2009 20:43:41 +0000 (20:43 +0000)
src/core/core_api.c
src/core/gnunet-service-core.c

index a6d729245ff9c9e659434883b4da6cba5fa2ffa5..1a74eb7d00e1ede7e83dfe7597ac03dfc8798623 100644 (file)
@@ -1054,6 +1054,12 @@ produce_send (void *cls, size_t size, void *buf)
   trigger_next_request (h);
   GNUNET_assert (size >= sizeof (struct SendMessage));
   dt = notify (notify_cls, size - sizeof (struct SendMessage), &sm[1]);
+  if (0 == dt)
+    {
+      /* client decided to send nothing! */
+      return 0;
+    }
+  GNUNET_assert (dt >= sizeof (struct GNUNET_MessageHeader));
   sm->header.size = htons (dt + sizeof (struct SendMessage));
   GNUNET_assert (dt + sizeof (struct SendMessage) < size);
   return dt + sizeof (struct SendMessage);
index d950237cde79f3cd74145e987b64429001222f15..1d272b873188a1484a3384e0c75da24948482d8f 100644 (file)
@@ -1750,6 +1750,10 @@ process_plaintext_neighbour_queue (struct Neighbour *n)
 
 /**
  * Handle CORE_SEND request.
+ *
+ * @param cls unused
+ * @param client the client issuing the request
+ * @param message the "struct SendMessage"
  */
 static void
 handle_client_send (void *cls,
@@ -1796,6 +1800,10 @@ send_connect_continuation (void *cls, size_t size, void *buf)
 
 /**
  * Handle CORE_SEND request.
+ *
+ * @param cls unused
+ * @param client the client issuing the request
+ * @param message the "struct SendMessage"
  */
 static void
 handle_client_send (void *cls,