From e81bbc8f2131c4ad7f7d27b4060694efefbdd13d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 6 Sep 2013 11:37:39 +0000 Subject: - initialize set type in test case - handle 1-peer consensus correcly - don't store peers in consensus api - updated consensus test case --- src/consensus/consensus_api.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'src/consensus/consensus_api.c') diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c index 873e72ca1..b2b3694d6 100644 --- a/src/consensus/consensus_api.c +++ b/src/consensus/consensus_api.c @@ -64,16 +64,6 @@ struct GNUNET_CONSENSUS_Handle */ 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. */ @@ -194,15 +184,7 @@ 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->num_peers = num_peers; 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, mq_handlers, NULL, consensus); @@ -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; - join_msg->num_peers = htonl (consensus->num_peers); + join_msg->num_peers = htonl (num_peers); 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; @@ -318,8 +300,6 @@ GNUNET_CONSENSUS_destroy (struct GNUNET_CONSENSUS_Handle *consensus) GNUNET_CLIENT_disconnect (consensus->client); consensus->client = NULL; } - if (NULL != consensus->peers) - GNUNET_free (consensus->peers); GNUNET_free (consensus); } -- cgit v1.2.3