-
-
-/**
- * Schedule transmitting the next message.
- *
- * @param consensus consensus handle
- */
-static void
-send_next (struct GNUNET_CONSENSUS_Handle *consensus);
-
-
-/**
- * Function called to notify a client about the connection
- * begin ready to queue more data. "buf" will be
- * NULL and "size" zero if the connection was closed for
- * writing in the meantime.
- *
- * @param cls closure
- * @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
-transmit_queued (void *cls, size_t size,
- void *buf)
-{
- struct GNUNET_CONSENSUS_Handle *consensus;
- struct QueuedMessage *qmsg;
- size_t msg_size;
-
- consensus = (struct GNUNET_CONSENSUS_Handle *) cls;
- consensus->th = NULL;
-
- qmsg = consensus->messages_head;
- GNUNET_CONTAINER_DLL_remove (consensus->messages_head, consensus->messages_tail, qmsg);
-
- if (NULL == buf)
- {
- if (NULL != qmsg->idc)
- {
- qmsg->idc (qmsg->idc_cls, GNUNET_YES);
- }
- return 0;
- }
-
- msg_size = ntohs (qmsg->msg->size);
-
- GNUNET_assert (size >= msg_size);
-
- memcpy (buf, qmsg->msg, msg_size);
- if (NULL != qmsg->idc)
- {
- qmsg->idc (qmsg->idc_cls, GNUNET_YES);
- }
- GNUNET_free (qmsg->msg);
- GNUNET_free (qmsg);
- /* FIXME: free the messages */
-
- send_next (consensus);
-
- return msg_size;
-}
-
-