aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2015-10-11 19:16:15 +0000
committerFlorian Dold <florian.dold@gmail.com>2015-10-11 19:16:15 +0000
commit97413eeadde62d7646b192348512abc4f4c36c2d (patch)
tree976e75557edd1ef9c2cd110fee45c476be9e7960
parent15f13cc7f9b59269a8b5ee8c750b5729b2c359ae (diff)
downloadgnunet-97413eeadde62d7646b192348512abc4f4c36c2d.tar.gz
gnunet-97413eeadde62d7646b192348512abc4f4c36c2d.zip
consensus
-rw-r--r--src/consensus/gnunet-consensus-profiler.c43
-rw-r--r--src/consensus/gnunet-service-consensus.c4
-rw-r--r--src/consensus/test_consensus.conf25
-rw-r--r--src/include/gnunet_consensus_service.h8
-rw-r--r--src/set/gnunet-service-set_union_strata_estimator.c2
5 files changed, 75 insertions, 7 deletions
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c
index a075cc291..143264f21 100644
--- a/src/consensus/gnunet-consensus-profiler.c
+++ b/src/consensus/gnunet-consensus-profiler.c
@@ -86,6 +86,44 @@ controller_cb (void *cls,
86 86
87 87
88static void 88static void
89statistics_done_db (void *cls,
90 struct
91 GNUNET_TESTBED_Operation
92 *op,
93 const char *emsg)
94{
95 GNUNET_assert (NULL == emsg);
96 GNUNET_TESTBED_operation_done (op);
97 printf ("statistics done\n");
98 GNUNET_SCHEDULER_shutdown ();
99}
100
101
102/**
103 * Callback function to process statistic values from all peers.
104 *
105 * @param cls closure
106 * @param peer the peer the statistic belong to
107 * @param subsystem name of subsystem that created the statistic
108 * @param name the name of the datum
109 * @param value the current value
110 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
111 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
112 */
113static int
114statistics_cb (void *cls,
115 const struct GNUNET_TESTBED_Peer *peer,
116 const char *subsystem,
117 const char *name,
118 uint64_t value,
119 int is_persistent)
120{
121 printf ("stat P%u: %s/%s=%lu\n", GNUNET_TESTBED_get_index (peer), subsystem, name, (unsigned long) value);
122 return GNUNET_OK;
123}
124
125
126static void
89destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx) 127destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx)
90{ 128{
91 struct GNUNET_CONSENSUS_Handle *consensus = cls; 129 struct GNUNET_CONSENSUS_Handle *consensus = cls;
@@ -104,7 +142,10 @@ destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx)
104 i, 142 i,
105 results_for_peer[i], 143 results_for_peer[i],
106 num_values); 144 num_values);
107 GNUNET_SCHEDULER_shutdown (); 145 GNUNET_TESTBED_get_statistics (num_peers, peers, NULL, NULL,
146 statistics_cb,
147 statistics_done_db,
148 NULL);
108 } 149 }
109} 150}
110 151
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index 296095f41..da18f816d 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -33,7 +33,6 @@
33#include "consensus_protocol.h" 33#include "consensus_protocol.h"
34#include "consensus.h" 34#include "consensus.h"
35 35
36#define GNUNET_CONSENSUS_ELEMENT_TYPE_USER_MAX 1 // FIXME
37#define ELEMENT_TYPE_CONTESTED_MARKER (GNUNET_CONSENSUS_ELEMENT_TYPE_USER_MAX + 1) 36#define ELEMENT_TYPE_CONTESTED_MARKER (GNUNET_CONSENSUS_ELEMENT_TYPE_USER_MAX + 1)
38 37
39 38
@@ -808,6 +807,7 @@ rfn_noncontested (struct ReferendumEntry *rfn)
808 return ret; 807 return ret;
809} 808}
810 809
810
811static void 811static void
812rfn_vote (struct ReferendumEntry *rfn, 812rfn_vote (struct ReferendumEntry *rfn,
813 uint16_t voting_peer, 813 uint16_t voting_peer,
@@ -2259,6 +2259,8 @@ install_step_timeouts (struct ConsensusSession *session)
2259 /* Given the fully constructed task graph 2259 /* Given the fully constructed task graph
2260 with rounds for tasks, we can give the tasks timeouts. */ 2260 with rounds for tasks, we can give the tasks timeouts. */
2261 2261
2262 // unsigned int max_round;
2263
2262 /* XXX: implement! */ 2264 /* XXX: implement! */
2263} 2265}
2264 2266
diff --git a/src/consensus/test_consensus.conf b/src/consensus/test_consensus.conf
index f8af4aa38..3c30968a9 100644
--- a/src/consensus/test_consensus.conf
+++ b/src/consensus/test_consensus.conf
@@ -1,14 +1,18 @@
1#@INLINE@ ../../contrib/no_forcestart.conf 1[arm]
2RESOURCE_DIAGNOSTICS = resource.log
2 3
3[PATHS] 4[PATHS]
4GNUNET_TEST_HOME = /tmp/test-consensus/ 5GNUNET_TEST_HOME = /tmp/test-consensus/
5 6
6[consensus] 7[consensus]
7PREFIX = valgrind 8#PREFIX = time -a -o time.out -f real:_%E_user:_%U_sys:_%S
9#PREFIX = time -a -o time.out -f real:_%E_user:_%U_sys:_%S
8OPTIONS = -L INFO 10OPTIONS = -L INFO
9BINARY = gnunet-service-evil-consensus 11BINARY = gnunet-service-evil-consensus
10 12
11EVIL_SPEC = 0;cram;5 13#EVIL_SPEC = 0;cram;5/1;cram;5
14#EVIL_SPEC = 0;cram;5/1;cram;3
15
12 16
13# Evil behavior: Peer 0 adds 5 random elements when he is the gradecast leader 17# Evil behavior: Peer 0 adds 5 random elements when he is the gradecast leader
14# (every peer gets the same element. 18# (every peer gets the same element.
@@ -18,11 +22,24 @@ EVIL_SPEC = 0;cram;5
18# (every peer gets different elements). 22# (every peer gets different elements).
19#EVIL_SPEC = 0;stuff-different;leader;5 23#EVIL_SPEC = 0;stuff-different;leader;5
20 24
21 25[arm]
26RESOURCE_DIAGNOSTICS = resource.log.${PEERID}
22 27
23[core] 28[core]
24FORECESTART = YES 29FORECESTART = YES
25 30
31[revocation]
32FORECESTART = NO
33
34[fs]
35FORECESTART = NO
36
37[gns]
38FORECESTART = NO
39
40[hostlist]
41FORECESTART = NO
42
26[cadet] 43[cadet]
27#PREFIX = valgrind 44#PREFIX = valgrind
28 45
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h
index f50e4376f..77607a6e2 100644
--- a/src/include/gnunet_consensus_service.h
+++ b/src/include/gnunet_consensus_service.h
@@ -43,6 +43,14 @@ extern "C"
43 43
44 44
45/** 45/**
46 * Elements inserted into the consensus set by the client
47 * may not be larger than this constant, since types in
48 * the upper range are used by CONSENSUS internally.
49 */
50#define GNUNET_CONSENSUS_ELEMENT_TYPE_USER_MAX 0xFFF0
51
52
53/**
46 * Called when a new element was received from another peer, or an error occured. 54 * Called when a new element was received from another peer, or an error occured.
47 * May deliver duplicate values. 55 * May deliver duplicate values.
48 * Elements given to a consensus operation by the local peer are NOT given 56 * Elements given to a consensus operation by the local peer are NOT given
diff --git a/src/set/gnunet-service-set_union_strata_estimator.c b/src/set/gnunet-service-set_union_strata_estimator.c
index 324d9d311..be14d353b 100644
--- a/src/set/gnunet-service-set_union_strata_estimator.c
+++ b/src/set/gnunet-service-set_union_strata_estimator.c
@@ -33,7 +33,7 @@
33 * Should we try compressing the strata estimator? This will 33 * Should we try compressing the strata estimator? This will
34 * break compatibility with the 0.10.1-network. 34 * break compatibility with the 0.10.1-network.
35 */ 35 */
36#define FAIL_10_1_COMPATIBILTIY 0 36#define FAIL_10_1_COMPATIBILTIY 1
37 37
38 38
39/** 39/**