aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/gnunet-service-consensus.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2014-02-03 21:25:53 +0000
committerFlorian Dold <florian.dold@gmail.com>2014-02-03 21:25:53 +0000
commit8a3563b5c242b60aa4b7d2b9a3c3607ef8dcbadb (patch)
treef4b85c248403ba6783db017930b2258f3e61e18a /src/consensus/gnunet-service-consensus.c
parent694581b42a78419c1c8ffc31ee873484ff93d79b (diff)
downloadgnunet-8a3563b5c242b60aa4b7d2b9a3c3607ef8dcbadb.tar.gz
gnunet-8a3563b5c242b60aa4b7d2b9a3c3607ef8dcbadb.zip
- consensus and secretsharing have both start time and deadline
Diffstat (limited to 'src/consensus/gnunet-service-consensus.c')
-rw-r--r--src/consensus/gnunet-service-consensus.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index 688190c14..ffd9786d3 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -142,6 +142,11 @@ struct ConsensusSession
142 struct GNUNET_MQ_Handle *client_mq; 142 struct GNUNET_MQ_Handle *client_mq;
143 143
144 /** 144 /**
145 * Time when the conclusion of the consensus should begin.
146 */
147 struct GNUNET_TIME_Absolute conclude_start;
148
149 /**
145 * Timeout for all rounds together, single rounds will schedule a timeout task 150 * Timeout for all rounds together, single rounds will schedule a timeout task
146 * with a fraction of the conclude timeout. 151 * with a fraction of the conclude timeout.
147 * Only valid once the current round is not CONSENSUS_ROUND_BEGIN. 152 * Only valid once the current round is not CONSENSUS_ROUND_BEGIN.
@@ -1039,6 +1044,9 @@ initialize_session (struct ConsensusSession *session,
1039 other_session = other_session->next; 1044 other_session = other_session->next;
1040 } 1045 }
1041 1046
1047 session->conclude_deadline = GNUNET_TIME_absolute_ntoh (join_msg->deadline);
1048 session->conclude_start = GNUNET_TIME_absolute_ntoh (join_msg->start);
1049
1042 session->local_peer_idx = get_peer_idx (&my_peer, session); 1050 session->local_peer_idx = get_peer_idx (&my_peer, session);
1043 GNUNET_assert (-1 != session->local_peer_idx); 1051 GNUNET_assert (-1 != session->local_peer_idx);
1044 session->element_set = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION); 1052 session->element_set = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
@@ -1168,11 +1176,8 @@ client_conclude (void *cls,
1168 const struct GNUNET_MessageHeader *message) 1176 const struct GNUNET_MessageHeader *message)
1169{ 1177{
1170 struct ConsensusSession *session; 1178 struct ConsensusSession *session;
1171 struct GNUNET_CONSENSUS_ConcludeMessage *cmsg;
1172
1173 1179
1174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "conclude requested\n"); 1180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "conclude requested\n");
1175 cmsg = (struct GNUNET_CONSENSUS_ConcludeMessage *) message;
1176 session = get_session_by_client (client); 1181 session = get_session_by_client (client);
1177 if (NULL == session) 1182 if (NULL == session)
1178 { 1183 {
@@ -1194,7 +1199,6 @@ client_conclude (void *cls,
1194 } 1199 }
1195 else 1200 else
1196 { 1201 {
1197 session->conclude_deadline = GNUNET_TIME_absolute_ntoh (cmsg->deadline);
1198 /* the 'begin' round is over, start with the next, actual round */ 1202 /* the 'begin' round is over, start with the next, actual round */
1199 round_over (session, NULL); 1203 round_over (session, NULL);
1200 } 1204 }
@@ -1257,7 +1261,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1257{ 1261{
1258 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = { 1262 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = {
1259 {&client_conclude, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE, 1263 {&client_conclude, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE,
1260 sizeof (struct GNUNET_CONSENSUS_ConcludeMessage)}, 1264 sizeof (struct GNUNET_MessageHeader)},
1261 {&client_insert, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT, 0}, 1265 {&client_insert, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT, 0},
1262 {&client_join, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN, 0}, 1266 {&client_join, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN, 0},
1263 {NULL, NULL, 0, 0} 1267 {NULL, NULL, 0, 0}