aboutsummaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-08-12 23:11:34 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-08-12 23:11:34 +0000
commitf4e5fc766bbabe63f68f82d1907e7f7ac5125b0d (patch)
treed7b75e129f4593045912200463ca4214f733bc75 /src/consensus
parentefb7b575ac99e67da4315ff9f7a5652413a8d472 (diff)
downloadgnunet-f4e5fc766bbabe63f68f82d1907e7f7ac5125b0d.tar.gz
gnunet-f4e5fc766bbabe63f68f82d1907e7f7ac5125b0d.zip
- fixed profiler
- less INFO, more DEBUG
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/gnunet-consensus.c7
-rw-r--r--src/consensus/gnunet-service-consensus.c54
-rw-r--r--src/consensus/test_consensus.conf4
3 files changed, 33 insertions, 32 deletions
diff --git a/src/consensus/gnunet-consensus.c b/src/consensus/gnunet-consensus.c
index dca18cece..42040527f 100644
--- a/src/consensus/gnunet-consensus.c
+++ b/src/consensus/gnunet-consensus.c
@@ -99,8 +99,9 @@ destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx)
99static void 99static void
100conclude_cb (void *cls) 100conclude_cb (void *cls)
101{ 101{
102 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "consensus done\n"); 102 struct GNUNET_CONSENSUS_Handle **chp = cls;
103 GNUNET_SCHEDULER_add_now (destroy, cls); 103 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "consensus %d done\n", chp - consensus_handles);
104 GNUNET_SCHEDULER_add_now (destroy, *chp);
104} 105}
105 106
106 107
@@ -159,7 +160,7 @@ do_consensus ()
159 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "all elements inserted, calling conclude\n"); 160 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "all elements inserted, calling conclude\n");
160 161
161 for (i = 0; i < num_peers; i++) 162 for (i = 0; i < num_peers; i++)
162 GNUNET_CONSENSUS_conclude (consensus_handles[i], conclude_timeout, conclude_cb, consensus_handles[i]); 163 GNUNET_CONSENSUS_conclude (consensus_handles[i], conclude_timeout, conclude_cb, &consensus_handles[i]);
163} 164}
164 165
165 166
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index cb7ab2c68..274b6f839 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -369,7 +369,7 @@ send_to_client_iter (void *cls,
369 { 369 {
370 struct GNUNET_CONSENSUS_ElementMessage *m; 370 struct GNUNET_CONSENSUS_ElementMessage *m;
371 371
372 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d: got element for client\n", 372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: got element for client\n",
373 session->local_peer_idx); 373 session->local_peer_idx);
374 374
375 ev = GNUNET_MQ_msg_extra (m, element->size, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT); 375 ev = GNUNET_MQ_msg_extra (m, element->size, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
@@ -379,7 +379,7 @@ send_to_client_iter (void *cls,
379 } 379 }
380 else 380 else
381 { 381 {
382 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d: finished iterating elements for client\n", 382 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: finished iterating elements for client\n",
383 session->local_peer_idx); 383 session->local_peer_idx);
384 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE); 384 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE);
385 GNUNET_MQ_send (session->client_mq, ev); 385 GNUNET_MQ_send (session->client_mq, ev);
@@ -406,7 +406,7 @@ round_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
406 return; 406 return;
407 407
408 session = cls; 408 session = cls;
409 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d: round over\n", session->local_peer_idx); 409 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: round over\n", session->local_peer_idx);
410 410
411 if (session->round_timeout_tid != GNUNET_SCHEDULER_NO_TASK) 411 if (session->round_timeout_tid != GNUNET_SCHEDULER_NO_TASK)
412 { 412 {
@@ -422,7 +422,7 @@ round_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
422 subround_over (session, NULL); 422 subround_over (session, NULL);
423 break; 423 break;
424 case CONSENSUS_ROUND_EXCHANGE: 424 case CONSENSUS_ROUND_EXCHANGE:
425 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d: finished, sending elements to client\n", 425 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: finished, sending elements to client\n",
426 session->local_peer_idx); 426 session->local_peer_idx);
427 session->current_round = CONSENSUS_ROUND_FINISH; 427 session->current_round = CONSENSUS_ROUND_FINISH;
428 GNUNET_SET_iterate (session->element_set, send_to_client_iter, session); 428 GNUNET_SET_iterate (session->element_set, send_to_client_iter, session);
@@ -494,7 +494,7 @@ find_partners (struct ConsensusSession *session)
494 largest_arc <<= 1; 494 largest_arc <<= 1;
495 num_ghosts = largest_arc - session->num_peers; 495 num_ghosts = largest_arc - session->num_peers;
496 496
497 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "num ghosts: %d\n", num_ghosts); 497 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "num ghosts: %d\n", num_ghosts);
498 498
499 if (0 == (my_idx & arc)) 499 if (0 == (my_idx & arc))
500 { 500 {
@@ -509,13 +509,13 @@ find_partners (struct ConsensusSession *session)
509 if (my_idx < num_ghosts) 509 if (my_idx < num_ghosts)
510 { 510 {
511 int ghost_partner_idx; 511 int ghost_partner_idx;
512 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "my index %d, arc %d, peers %u\n", my_idx, arc, session->num_peers); 512 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "my index %d, arc %d, peers %u\n", my_idx, arc, session->num_peers);
513 ghost_partner_idx = (my_idx - (int) arc) % (int) session->num_peers; 513 ghost_partner_idx = (my_idx - (int) arc) % (int) session->num_peers;
514 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ghost partner is before %d\n", ghost_partner_idx); 514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ghost partner is before %d\n", ghost_partner_idx);
515 /* platform dependent; modulo sometimes returns negative values */ 515 /* platform dependent; modulo sometimes returns negative values */
516 if (ghost_partner_idx < 0) 516 if (ghost_partner_idx < 0)
517 ghost_partner_idx += session->num_peers; 517 ghost_partner_idx += session->num_peers;
518 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ghost partner is after %d\n", ghost_partner_idx); 518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ghost partner is after %d\n", ghost_partner_idx);
519 session->partner_incoming = &session->info[session->shuffle[ghost_partner_idx]]; 519 session->partner_incoming = &session->info[session->shuffle[ghost_partner_idx]];
520 session->partner_incoming->exp_subround_finished = GNUNET_NO; 520 session->partner_incoming->exp_subround_finished = GNUNET_NO;
521 return; 521 return;
@@ -555,29 +555,29 @@ set_result_cb (void *cls,
555 switch (status) 555 switch (status)
556 { 556 {
557 case GNUNET_SET_STATUS_OK: 557 case GNUNET_SET_STATUS_OK:
558 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: set result from P%u: element\n", 558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: set result from P%u: element\n",
559 local_idx, remote_idx); 559 local_idx, remote_idx);
560 break; 560 break;
561 case GNUNET_SET_STATUS_FAILURE: 561 case GNUNET_SET_STATUS_FAILURE:
562 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: set result from P%u: failure\n", 562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: set result from P%u: failure\n",
563 local_idx, remote_idx); 563 local_idx, remote_idx);
564 cpi->set_op = NULL; 564 cpi->set_op = NULL;
565 return; 565 return;
566 case GNUNET_SET_STATUS_HALF_DONE: 566 case GNUNET_SET_STATUS_HALF_DONE:
567 case GNUNET_SET_STATUS_DONE: 567 case GNUNET_SET_STATUS_DONE:
568 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: set result from P%u: done\n", 568 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: set result from P%u: done\n",
569 local_idx, remote_idx); 569 local_idx, remote_idx);
570 cpi->exp_subround_finished = GNUNET_YES; 570 cpi->exp_subround_finished = GNUNET_YES;
571 cpi->set_op = NULL; 571 cpi->set_op = NULL;
572 if (have_exp_subround_finished (cpi->session) == GNUNET_YES) 572 if (have_exp_subround_finished (cpi->session) == GNUNET_YES)
573 { 573 {
574 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: all reconciliations of subround done\n", 574 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: all reconciliations of subround done\n",
575 local_idx); 575 local_idx);
576 subround_over (cpi->session, NULL); 576 subround_over (cpi->session, NULL);
577 } 577 }
578 else 578 else
579 { 579 {
580 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: waiting for further set results\n", 580 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: waiting for further set results\n",
581 local_idx); 581 local_idx);
582 } 582 }
583 return; 583 return;
@@ -731,7 +731,7 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
731 GNUNET_SET_commit (session->partner_incoming->delayed_set_op, session->element_set); 731 GNUNET_SET_commit (session->partner_incoming->delayed_set_op, session->element_set);
732 session->partner_incoming->set_op = session->partner_incoming->delayed_set_op; 732 session->partner_incoming->set_op = session->partner_incoming->delayed_set_op;
733 session->partner_incoming->delayed_set_op = NULL; 733 session->partner_incoming->delayed_set_op = NULL;
734 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d resumed delayed round with P%d\n", 734 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d resumed delayed round with P%d\n",
735 session->local_peer_idx, (int) (session->partner_incoming - session->info)); 735 session->local_peer_idx, (int) (session->partner_incoming - session->info));
736 } 736 }
737 else 737 else
@@ -753,7 +753,7 @@ subround_over (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
753 in = -1; 753 in = -1;
754 else 754 else
755 in = (int) (session->partner_incoming - session->info); 755 in = (int) (session->partner_incoming - session->info);
756 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: doing exp-round, r=%d, sub=%d, in: %d, out: %d\n", session->local_peer_idx, 756 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: doing exp-round, r=%d, sub=%d, in: %d, out: %d\n", session->local_peer_idx,
757 session->exp_round, session->exp_subround, in, out); 757 session->exp_round, session->exp_subround, in, out);
758 } 758 }
759#endif /* GNUNET_EXTRA_LOGGING */ 759#endif /* GNUNET_EXTRA_LOGGING */
@@ -930,7 +930,7 @@ set_listen_cb (void *cls,
930 930
931 cpi = &session->info[index]; 931 cpi = &session->info[index];
932 932
933 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d got set request from P%d\n", session->local_peer_idx, index); 933 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d got set request from P%d\n", session->local_peer_idx, index);
934 934
935 switch (session->current_round) 935 switch (session->current_round)
936 { 936 {
@@ -956,7 +956,7 @@ set_listen_cb (void *cls,
956 { 956 {
957 cpi->set_op = set_op; 957 cpi->set_op = set_op;
958 GNUNET_SET_commit (set_op, session->element_set); 958 GNUNET_SET_commit (set_op, session->element_set);
959 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d commited to set request from P%d\n", session->local_peer_idx, index); 959 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d commited to set request from P%d\n", session->local_peer_idx, index);
960 } 960 }
961 else 961 else
962 { 962 {
@@ -964,7 +964,7 @@ set_listen_cb (void *cls,
964 cpi->delayed_set_op = set_op; 964 cpi->delayed_set_op = set_op;
965 cpi->delayed_round_info = round_info; 965 cpi->delayed_round_info = round_info;
966 cpi->exp_subround_finished = GNUNET_YES; 966 cpi->exp_subround_finished = GNUNET_YES;
967 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%d delaying set request from P%d\n", session->local_peer_idx, index); 967 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d delaying set request from P%d\n", session->local_peer_idx, index);
968 } 968 }
969 break; 969 break;
970 default: 970 default:
@@ -987,7 +987,7 @@ initialize_session (struct ConsensusSession *session,
987 struct ConsensusSession *other_session; 987 struct ConsensusSession *other_session;
988 988
989 initialize_session_peer_list (session, join_msg); 989 initialize_session_peer_list (session, join_msg);
990 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "session with %u peers\n", session->num_peers); 990 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "session with %u peers\n", session->num_peers);
991 compute_global_id (session, &join_msg->session_id); 991 compute_global_id (session, &join_msg->session_id);
992 992
993 /* check if some local client already owns the session. 993 /* check if some local client already owns the session.
@@ -1017,8 +1017,8 @@ initialize_session (struct ConsensusSession *session,
1017 session->set_listener = GNUNET_SET_listen (cfg, GNUNET_SET_OPERATION_UNION, 1017 session->set_listener = GNUNET_SET_listen (cfg, GNUNET_SET_OPERATION_UNION,
1018 &session->global_id, 1018 &session->global_id,
1019 set_listen_cb, session); 1019 set_listen_cb, session);
1020 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%d is the local peer\n", session->local_peer_idx); 1020 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%d is the local peer\n", session->local_peer_idx);
1021 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "session %s initialized\n", GNUNET_h2s (&session->global_id)); 1021 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "session %s initialized\n", GNUNET_h2s (&session->global_id));
1022} 1022}
1023 1023
1024 1024
@@ -1052,7 +1052,7 @@ client_join (void *cls,
1052{ 1052{
1053 struct ConsensusSession *session; 1053 struct ConsensusSession *session;
1054 1054
1055 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "join message sent by client\n"); 1055 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "join message sent by client\n");
1056 1056
1057 session = get_session_by_client (client); 1057 session = get_session_by_client (client);
1058 if (NULL != session) 1058 if (NULL != session)
@@ -1068,7 +1068,7 @@ client_join (void *cls,
1068 initialize_session (session, (struct GNUNET_CONSENSUS_JoinMessage *) m); 1068 initialize_session (session, (struct GNUNET_CONSENSUS_JoinMessage *) m);
1069 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1069 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1070 1070
1071 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "join done\n"); 1071 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "join done\n");
1072} 1072}
1073 1073
1074 1074
@@ -1122,7 +1122,7 @@ client_insert (void *cls,
1122 GNUNET_free (element); 1122 GNUNET_free (element);
1123 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1123 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1124 1124
1125 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: element added\n", session->local_peer_idx); 1125 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: element added\n", session->local_peer_idx);
1126} 1126}
1127 1127
1128 1128
@@ -1142,7 +1142,7 @@ client_conclude (void *cls,
1142 struct GNUNET_CONSENSUS_ConcludeMessage *cmsg; 1142 struct GNUNET_CONSENSUS_ConcludeMessage *cmsg;
1143 1143
1144 1144
1145 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "conclude requested\n"); 1145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "conclude requested\n");
1146 cmsg = (struct GNUNET_CONSENSUS_ConcludeMessage *) message; 1146 cmsg = (struct GNUNET_CONSENSUS_ConcludeMessage *) message;
1147 session = get_session_by_client (client); 1147 session = get_session_by_client (client);
1148 if (NULL == session) 1148 if (NULL == session)
@@ -1188,7 +1188,7 @@ shutdown_task (void *cls,
1188 while (NULL != sessions_head) 1188 while (NULL != sessions_head)
1189 destroy_session (sessions_head); 1189 destroy_session (sessions_head);
1190 1190
1191 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "handled shutdown request\n"); 1191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "handled shutdown request\n");
1192} 1192}
1193 1193
1194 1194
@@ -1211,7 +1211,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
1211 (CONSENSUS_ROUND_FINISH == session->current_round)) 1211 (CONSENSUS_ROUND_FINISH == session->current_round))
1212 destroy_session (session); 1212 destroy_session (session);
1213 else 1213 else
1214 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "client disconnected, but waiting for consensus to finish\n"); 1214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client disconnected, but waiting for consensus to finish\n");
1215} 1215}
1216 1216
1217 1217
diff --git a/src/consensus/test_consensus.conf b/src/consensus/test_consensus.conf
index 571d378fa..a11564a01 100644
--- a/src/consensus/test_consensus.conf
+++ b/src/consensus/test_consensus.conf
@@ -5,7 +5,7 @@ HOSTNAME = localhost
5HOME = $SERVICEHOME 5HOME = $SERVICEHOME
6BINARY = gnunet-service-consensus 6BINARY = gnunet-service-consensus
7#PREFIX = gdbserver :12345 7#PREFIX = gdbserver :12345
8PREFIX = valgrind --leak-check=full 8#PREFIX = valgrind --leak-check=full
9ACCEPT_FROM = 127.0.0.1; 9ACCEPT_FROM = 127.0.0.1;
10ACCEPT_FROM6 = ::1; 10ACCEPT_FROM6 = ::1;
11UNIXPATH = /tmp/gnunet-service-consensus.sock 11UNIXPATH = /tmp/gnunet-service-consensus.sock
@@ -23,7 +23,7 @@ DEFAULTSERVICES = core consensus set
23 23
24[set] 24[set]
25OPTIONS = -L INFO 25OPTIONS = -L INFO
26PREFIX = valgrind --leak-check=full 26#PREFIX = valgrind --leak-check=full
27 27
28 28
29[testbed] 29[testbed]