-/**
- * Function called to notify a client about the socket
- * being ready to queue more data. "buf" will be
- * NULL and "size" zero if the socket was closed for
- * writing in the meantime.
- *
- * @param cls closure (data itself)
- * @param size number of bytes available in buf
- * @param buf where the callee should write the message
- * @return number of bytes written to buf
- */
-static size_t
-send_core_data_unicast (void *cls, size_t size, void *buf)
-{
- struct MeshDataDescriptor *info = cls;
- struct GNUNET_MESH_Unicast *msg = buf;
- size_t total_size;
-
- GNUNET_assert (NULL != info);
- total_size = sizeof (struct GNUNET_MESH_Unicast) + info->size;
- GNUNET_assert (total_size < 65536); /* UNIT16_MAX */
-
- if (total_size > size)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "not enough buffer to send data to peer\n");
- return 0;
- }
- msg->header.size = htons (total_size);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_UNICAST);
- GNUNET_PEER_resolve (info->origin->oid, &msg->oid);
- GNUNET_PEER_resolve (info->destination, &msg->destination);
- msg->tid = htonl (info->origin->tid);
- if (0 != info->size)
- {
- memcpy (&msg[1], &info[1], info->size);
- }
- if (NULL != info->client)
- {
- GNUNET_SERVER_receive_done (info->client, GNUNET_OK);
- }
- GNUNET_free (info);
- return total_size;
-}
-