struct GNUNET_HashCode session_id;
/**
- * GNUNES_YES iff the join message has been sent to the service.
+ * #GNUNET_YES iff the join message has been sent to the service.
*/
int joined;
GNUNET_CONSENSUS_ElementCallback new_element_cb,
void *new_element_cls)
{
- GNUNET_MQ_hd_var_size (new_element,
- GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT,
- struct GNUNET_CONSENSUS_ElementMessage);
- GNUNET_MQ_hd_fixed_size (conclude_done,
- GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE,
- struct GNUNET_MessageHeader);
struct GNUNET_CONSENSUS_Handle *consensus
= GNUNET_new (struct GNUNET_CONSENSUS_Handle);
struct GNUNET_MQ_MessageHandler mq_handlers[] = {
- make_new_element_handler (consensus),
- make_conclude_done_handler (consensus),
+ GNUNET_MQ_hd_var_size (new_element,
+ GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT,
+ struct GNUNET_CONSENSUS_ElementMessage,
+ consensus),
+ GNUNET_MQ_hd_fixed_size (conclude_done,
+ GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE,
+ struct GNUNET_MessageHeader,
+ consensus),
GNUNET_MQ_handler_end ()
};
struct GNUNET_CONSENSUS_JoinMessage *join_msg;
struct GNUNET_MQ_Envelope *ev;
- struct GNUNET_CLIENT_Connection *client;
consensus->cfg = cfg;
consensus->new_element_cb = new_element_cb;
consensus->new_element_cls = new_element_cls;
consensus->session_id = *session_id;
- client = GNUNET_CLIENT_connect ("consensus", cfg);
- if (NULL == client)
+ consensus->mq = GNUNET_CLIENT_connect (cfg,
+ "consensus",
+ mq_handlers,
+ &mq_error_handler,
+ consensus);
+ if (NULL == consensus->mq)
{
GNUNET_free (consensus);
return NULL;
}
- consensus->mq = GNUNET_MQ_queue_for_connection_client (client,
- mq_handlers,
- &mq_error_handler,
- consensus);
ev = GNUNET_MQ_msg_extra (join_msg,
(num_peers * sizeof (struct GNUNET_PeerIdentity)),
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN);
join_msg->start = GNUNET_TIME_absolute_hton (start);
join_msg->deadline = GNUNET_TIME_absolute_hton (deadline);
join_msg->num_peers = htonl (num_peers);
- memcpy(&join_msg[1],
+ GNUNET_memcpy(&join_msg[1],
peers,
num_peers * sizeof (struct GNUNET_PeerIdentity));
ev = GNUNET_MQ_msg_extra (element_msg, element->size,
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
- memcpy (&element_msg[1], element->data, element->size);
+ GNUNET_memcpy (&element_msg[1], element->data, element->size);
if (NULL != idc)
{