projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
migrating towards XDG configuration specification (#3000)
[oweals/gnunet.git]
/
src
/
consensus
/
consensus_api.c
diff --git
a/src/consensus/consensus_api.c
b/src/consensus/consensus_api.c
index a1dc4082616010de81a5c162cc95af0254e36f9e..d8e65c52fd202ecd150737219c9189183b605cb8 100644
(file)
--- a/
src/consensus/consensus_api.c
+++ b/
src/consensus/consensus_api.c
@@
-20,7
+20,7
@@
/**
* @file consensus/consensus_api.c
/**
* @file consensus/consensus_api.c
- * @brief
+ * @brief
* @author Florian Dold
*/
#include "platform.h"
* @author Florian Dold
*/
#include "platform.h"
@@
-64,16
+64,6
@@
struct GNUNET_CONSENSUS_Handle
*/
struct GNUNET_HashCode session_id;
*/
struct GNUNET_HashCode session_id;
- /**
- * Number of peers in the consensus. Optionally includes the local peer.
- */
- int num_peers;
-
- /**
- * Peer identities of peers participating in the consensus, includes the local peer.
- */
- struct GNUNET_PeerIdentity **peers;
-
/**
* GNUNES_YES iff the join message has been sent to the service.
*/
/**
* GNUNES_YES iff the join message has been sent to the service.
*/
@@
-113,7
+103,7
@@
struct InsertDoneInfo
/**
* Called when the server has sent is a new element
/**
* Called when the server has sent is a new element
- *
+ *
* @param cls consensus handle
* @param mh element message
*/
* @param cls consensus handle
* @param mh element message
*/
@@
-139,7
+129,7
@@
handle_new_element (void *cls,
/**
* Called when the server has announced
* that the conclusion is over.
/**
* Called when the server has announced
* that the conclusion is over.
- *
+ *
* @param cls consensus handle
* @param msg conclude done message
*/
* @param cls consensus handle
* @param msg conclude done message
*/
@@
-194,18
+184,10
@@
GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
consensus->cfg = cfg;
consensus->new_element_cb = new_element_cb;
consensus->new_element_cls = new_element_cls;
consensus->cfg = cfg;
consensus->new_element_cb = new_element_cb;
consensus->new_element_cls = new_element_cls;
- consensus->num_peers = num_peers;
consensus->session_id = *session_id;
consensus->session_id = *session_id;
-
- if (0 == num_peers)
- consensus->peers = NULL;
- else if (num_peers > 0)
- consensus->peers =
- GNUNET_memdup (peers, num_peers * sizeof (struct GNUNET_PeerIdentity));
-
consensus->client = GNUNET_CLIENT_connect ("consensus", cfg);
consensus->mq = GNUNET_MQ_queue_for_connection_client (consensus->client,
consensus->client = GNUNET_CLIENT_connect ("consensus", cfg);
consensus->mq = GNUNET_MQ_queue_for_connection_client (consensus->client,
- mq_handlers, consensus);
+ mq_handlers,
NULL,
consensus);
GNUNET_assert (consensus->client != NULL);
GNUNET_assert (consensus->client != NULL);
@@
-214,10
+196,10
@@
GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN);
join_msg->session_id = consensus->session_id;
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN);
join_msg->session_id = consensus->session_id;
- join_msg->num_peers = htonl (
consensus->
num_peers);
+ join_msg->num_peers = htonl (num_peers);
memcpy(&join_msg[1],
memcpy(&join_msg[1],
-
consensus->
peers,
-
consensus->
num_peers * sizeof (struct GNUNET_PeerIdentity));
+ peers,
+ num_peers * sizeof (struct GNUNET_PeerIdentity));
GNUNET_MQ_send (consensus->mq, ev);
return consensus;
GNUNET_MQ_send (consensus->mq, ev);
return consensus;
@@
-238,7
+220,7
@@
idc_adapter (void *cls)
*
* @param consensus handle for the consensus session
* @param element the element to be inserted
*
* @param consensus handle for the consensus session
* @param element the element to be inserted
- * @param idc function called when we are done with this element and it
+ * @param idc function called when we are done with this element and it
* is thus allowed to call GNUNET_CONSENSUS_insert again
* @param idc_cls closure for 'idc'
*/
* is thus allowed to call GNUNET_CONSENSUS_insert again
* @param idc_cls closure for 'idc'
*/
@@
-258,7
+240,7
@@
GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
memcpy (&element_msg[1], element->data, element->size);
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
memcpy (&element_msg[1], element->data, element->size);
-
+
if (NULL != idc)
{
i = GNUNET_new (struct InsertDoneInfo);
if (NULL != idc)
{
i = GNUNET_new (struct InsertDoneInfo);
@@
-266,6
+248,7
@@
GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
i->cls = idc_cls;
GNUNET_MQ_notify_sent (ev, idc_adapter, i);
}
i->cls = idc_cls;
GNUNET_MQ_notify_sent (ev, idc_adapter, i);
}
+ GNUNET_MQ_send (consensus->mq, ev);
}
}
@@
-317,8
+300,6
@@
GNUNET_CONSENSUS_destroy (struct GNUNET_CONSENSUS_Handle *consensus)
GNUNET_CLIENT_disconnect (consensus->client);
consensus->client = NULL;
}
GNUNET_CLIENT_disconnect (consensus->client);
consensus->client = NULL;
}
- if (NULL != consensus->peers)
- GNUNET_free (consensus->peers);
GNUNET_free (consensus);
}
GNUNET_free (consensus);
}