aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-10-14 10:06:24 +0200
committerJulius Bünger <buenger@mytum.de>2018-10-14 10:06:24 +0200
commit10a1964c7c8fc9d2f9eab2942fa71fa00318a1b4 (patch)
tree2ae059349f96d1bb7c270257444c39c3bcf49750 /src/rps
parent6ebd7d015990554594f5668cdccc4fe2da629fbf (diff)
downloadgnunet-10a1964c7c8fc9d2f9eab2942fa71fa00318a1b4.tar.gz
gnunet-10a1964c7c8fc9d2f9eab2942fa71fa00318a1b4.zip
RPS service: Only change statistics from main sub
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-service-rps.c302
1 files changed, 188 insertions, 114 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 791c5328c..4c8914627 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -609,10 +609,13 @@ create_peer_ctx (struct Sub *sub,
609 ret = GNUNET_CONTAINER_multipeermap_put (sub->peer_map, peer, ctx, 609 ret = GNUNET_CONTAINER_multipeermap_put (sub->peer_map, peer, ctx,
610 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 610 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
611 GNUNET_assert (GNUNET_OK == ret); 611 GNUNET_assert (GNUNET_OK == ret);
612 GNUNET_STATISTICS_set (stats, 612 if (sub == msub)
613 "# known peers", 613 {
614 GNUNET_CONTAINER_multipeermap_size (sub->peer_map), 614 GNUNET_STATISTICS_set (stats,
615 GNUNET_NO); 615 "# known peers",
616 GNUNET_CONTAINER_multipeermap_size (sub->peer_map),
617 GNUNET_NO);
618 }
616 return ctx; 619 return ctx;
617} 620}
618 621
@@ -779,10 +782,13 @@ add_valid_peer (const struct GNUNET_PeerIdentity *peer,
779 } 782 }
780 (void) GNUNET_CONTAINER_multipeermap_put (valid_peers, peer, NULL, 783 (void) GNUNET_CONTAINER_multipeermap_put (valid_peers, peer, NULL,
781 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 784 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
782 GNUNET_STATISTICS_set (stats, 785 if (valid_peers == msub->valid_peers)
783 "# valid peers", 786 {
784 GNUNET_CONTAINER_multipeermap_size (valid_peers), 787 GNUNET_STATISTICS_set (stats,
785 GNUNET_NO); 788 "# valid peers",
789 GNUNET_CONTAINER_multipeermap_size (valid_peers),
790 GNUNET_NO);
791 }
786 return ret; 792 return ret;
787} 793}
788 794
@@ -1078,10 +1084,13 @@ check_peer_online (struct PeerContext *peer_ctx)
1078 mq_online_check_successful, 1084 mq_online_check_successful,
1079 peer_ctx); 1085 peer_ctx);
1080 GNUNET_MQ_send (mq, ev); 1086 GNUNET_MQ_send (mq, ev);
1081 GNUNET_STATISTICS_update (stats, 1087 if (peer_ctx->sub == msub)
1082 "# pending online checks", 1088 {
1083 1, 1089 GNUNET_STATISTICS_update (stats,
1084 GNUNET_NO); 1090 "# pending online checks",
1091 1,
1092 GNUNET_NO);
1093 }
1085} 1094}
1086 1095
1087 1096
@@ -1222,10 +1231,13 @@ destroy_peer (struct PeerContext *peer_ctx)
1222 sizeof (struct PendingMessage))) ) 1231 sizeof (struct PendingMessage))) )
1223 { 1232 {
1224 peer_ctx->online_check_pending = NULL; 1233 peer_ctx->online_check_pending = NULL;
1225 GNUNET_STATISTICS_update (stats, 1234 if (peer_ctx->sub == msub)
1226 "# pending online checks", 1235 {
1227 -1, 1236 GNUNET_STATISTICS_update (stats,
1228 GNUNET_NO); 1237 "# pending online checks",
1238 -1,
1239 GNUNET_NO);
1240 }
1229 } 1241 }
1230 remove_pending_message (peer_ctx->pending_messages_head, 1242 remove_pending_message (peer_ctx->pending_messages_head,
1231 GNUNET_YES); 1243 GNUNET_YES);
@@ -1268,10 +1280,13 @@ destroy_peer (struct PeerContext *peer_ctx)
1268 LOG (GNUNET_ERROR_TYPE_WARNING, 1280 LOG (GNUNET_ERROR_TYPE_WARNING,
1269 "removing peer from peer_ctx->sub->peer_map failed\n"); 1281 "removing peer from peer_ctx->sub->peer_map failed\n");
1270 } 1282 }
1271 GNUNET_STATISTICS_set (stats, 1283 if (peer_ctx->sub == msub)
1272 "# known peers", 1284 {
1273 GNUNET_CONTAINER_multipeermap_size (peer_ctx->sub->peer_map), 1285 GNUNET_STATISTICS_set (stats,
1274 GNUNET_NO); 1286 "# known peers",
1287 GNUNET_CONTAINER_multipeermap_size (peer_ctx->sub->peer_map),
1288 GNUNET_NO);
1289 }
1275 GNUNET_free (peer_ctx); 1290 GNUNET_free (peer_ctx);
1276 return GNUNET_YES; 1291 return GNUNET_YES;
1277} 1292}
@@ -1313,12 +1328,15 @@ mq_notify_sent_cb (void *cls)
1313 LOG (GNUNET_ERROR_TYPE_DEBUG, 1328 LOG (GNUNET_ERROR_TYPE_DEBUG,
1314 "%s was sent.\n", 1329 "%s was sent.\n",
1315 pending_msg->type); 1330 pending_msg->type);
1316 if (0 == strncmp ("PULL REPLY", pending_msg->type, 10)) 1331 if (pending_msg->peer_ctx->sub == msub)
1317 GNUNET_STATISTICS_update(stats, "# pull replys sent", 1, GNUNET_NO); 1332 {
1318 if (0 == strncmp ("PULL REQUEST", pending_msg->type, 12)) 1333 if (0 == strncmp ("PULL REPLY", pending_msg->type, 10))
1319 GNUNET_STATISTICS_update(stats, "# pull requests sent", 1, GNUNET_NO); 1334 GNUNET_STATISTICS_update(stats, "# pull replys sent", 1, GNUNET_NO);
1320 if (0 == strncmp ("PUSH", pending_msg->type, 4)) 1335 if (0 == strncmp ("PULL REQUEST", pending_msg->type, 12))
1321 GNUNET_STATISTICS_update(stats, "# pushes sent", 1, GNUNET_NO); 1336 GNUNET_STATISTICS_update(stats, "# pull requests sent", 1, GNUNET_NO);
1337 if (0 == strncmp ("PUSH", pending_msg->type, 4))
1338 GNUNET_STATISTICS_update(stats, "# pushes sent", 1, GNUNET_NO);
1339 }
1322 /* Do not cancle message */ 1340 /* Do not cancle message */
1323 remove_pending_message (pending_msg, GNUNET_NO); 1341 remove_pending_message (pending_msg, GNUNET_NO);
1324} 1342}
@@ -2138,10 +2156,13 @@ insert_in_view (struct Sub *sub,
2138 /* Open channel towards peer to keep connection open */ 2156 /* Open channel towards peer to keep connection open */
2139 indicate_sending_intention (peer_ctx); 2157 indicate_sending_intention (peer_ctx);
2140 ret = View_put (sub->view, peer); 2158 ret = View_put (sub->view, peer);
2141 GNUNET_STATISTICS_set (stats, 2159 if (peer_ctx->sub == msub)
2142 "view size", 2160 {
2143 View_size (peer_ctx->sub->view), 2161 GNUNET_STATISTICS_set (stats,
2144 GNUNET_NO); 2162 "view size",
2163 View_size (peer_ctx->sub->view),
2164 GNUNET_NO);
2165 }
2145 return ret; 2166 return ret;
2146} 2167}
2147 2168
@@ -2160,19 +2181,14 @@ send_view (const struct ClientContext *cli_ctx,
2160{ 2181{
2161 struct GNUNET_MQ_Envelope *ev; 2182 struct GNUNET_MQ_Envelope *ev;
2162 struct GNUNET_RPS_CS_DEBUG_ViewReply *out_msg; 2183 struct GNUNET_RPS_CS_DEBUG_ViewReply *out_msg;
2184 struct Sub *sub;
2163 2185
2164 if (NULL == view_array) 2186 if (NULL == view_array)
2165 { 2187 {
2166 if (NULL == cli_ctx->sub) 2188 if (NULL == cli_ctx->sub) sub = msub;
2167 { 2189 else sub = cli_ctx->sub;
2168 view_size = View_size (msub->view); 2190 view_size = View_size (sub->view);
2169 view_array = View_get_as_array (msub->view); 2191 view_array = View_get_as_array (sub->view);
2170 }
2171 else
2172 {
2173 view_size = View_size (cli_ctx->sub->view);
2174 view_array = View_get_as_array (cli_ctx->sub->view);
2175 }
2176 } 2192 }
2177 2193
2178 ev = GNUNET_MQ_msg_extra (out_msg, 2194 ev = GNUNET_MQ_msg_extra (out_msg,
@@ -2381,10 +2397,13 @@ add_peer_array_to_set (const struct GNUNET_PeerIdentity *peer_array,
2381 &peer_array[i], 2397 &peer_array[i],
2382 NULL, 2398 NULL,
2383 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 2399 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
2384 GNUNET_STATISTICS_set (stats, 2400 if (msub->peer_map == peer_map)
2385 "# known peers", 2401 {
2386 GNUNET_CONTAINER_multipeermap_size (peer_map), 2402 GNUNET_STATISTICS_set (stats,
2387 GNUNET_NO); 2403 "# known peers",
2404 GNUNET_CONTAINER_multipeermap_size (peer_map),
2405 GNUNET_NO);
2406 }
2388 } 2407 }
2389} 2408}
2390 2409
@@ -2433,7 +2452,10 @@ send_pull_reply (struct PeerContext *peer_ctx,
2433 send_size * sizeof (struct GNUNET_PeerIdentity)); 2452 send_size * sizeof (struct GNUNET_PeerIdentity));
2434 2453
2435 send_message (peer_ctx, ev, "PULL REPLY"); 2454 send_message (peer_ctx, ev, "PULL REPLY");
2436 GNUNET_STATISTICS_update(stats, "# pull reply send issued", 1, GNUNET_NO); 2455 if (peer_ctx->sub == msub)
2456 {
2457 GNUNET_STATISTICS_update(stats, "# pull reply send issued", 1, GNUNET_NO);
2458 }
2437 // TODO check with send intention: as send_channel is used/opened we indicate 2459 // TODO check with send intention: as send_channel is used/opened we indicate
2438 // a sending intention without intending it. 2460 // a sending intention without intending it.
2439 // -> clean peer afterwards? 2461 // -> clean peer afterwards?
@@ -2548,10 +2570,13 @@ got_peer (struct Sub *sub,
2548 schedule_operation (get_peer_ctx (sub->peer_map, peer), 2570 schedule_operation (get_peer_ctx (sub->peer_map, peer),
2549 &insert_in_view_op, sub); 2571 &insert_in_view_op, sub);
2550 } 2572 }
2551 GNUNET_STATISTICS_update (stats, 2573 if (sub == msub)
2552 "# learnd peers", 2574 {
2553 1, 2575 GNUNET_STATISTICS_update (stats,
2554 GNUNET_NO); 2576 "# learnd peers",
2577 1,
2578 GNUNET_NO);
2579 }
2555} 2580}
2556 2581
2557 2582
@@ -2788,10 +2813,13 @@ new_sub (const struct GNUNET_HashCode *hash,
2788 sub->pull_map = CustomPeerMap_create (4); 2813 sub->pull_map = CustomPeerMap_create (4);
2789 sub->view_size_est_min = sampler_size;; 2814 sub->view_size_est_min = sampler_size;;
2790 sub->view = View_create (sub->view_size_est_min); 2815 sub->view = View_create (sub->view_size_est_min);
2791 GNUNET_STATISTICS_set (stats, 2816 if (sub == msub)
2792 "view size aim", 2817 {
2793 sub->view_size_est_min, 2818 GNUNET_STATISTICS_set (stats,
2794 GNUNET_NO); 2819 "view size aim",
2820 sub->view_size_est_min,
2821 GNUNET_NO);
2822 }
2795 2823
2796 /* Start executing rounds */ 2824 /* Start executing rounds */
2797 sub->do_round_task = GNUNET_SCHEDULER_add_now (&do_round, sub); 2825 sub->do_round_task = GNUNET_SCHEDULER_add_now (&do_round, sub);
@@ -2900,7 +2928,13 @@ adapt_sizes (struct Sub *sub, double logestimate, double std_dev)
2900 //sub->sampler_size_est_need = sub->view_size_est_min; 2928 //sub->sampler_size_est_need = sub->view_size_est_min;
2901 sub->view_size_est_need = sub->view_size_est_min; 2929 sub->view_size_est_need = sub->view_size_est_min;
2902 } 2930 }
2903 GNUNET_STATISTICS_set (stats, "view size aim", sub->view_size_est_need, GNUNET_NO); 2931 if (sub == msub)
2932 {
2933 GNUNET_STATISTICS_set (stats,
2934 "view size aim",
2935 sub->view_size_est_need,
2936 GNUNET_NO);
2937 }
2904 2938
2905 /* If the NSE has changed adapt the lists accordingly */ 2939 /* If the NSE has changed adapt the lists accordingly */
2906 resize_wrapper (sub->sampler, sub->sampler_size_est_need); 2940 resize_wrapper (sub->sampler, sub->sampler_size_est_need);
@@ -3004,7 +3038,7 @@ handle_client_seed (void *cls,
3004 i, 3038 i,
3005 GNUNET_i2s (&peers[i])); 3039 GNUNET_i2s (&peers[i]));
3006 3040
3007 if (NULL != msub) got_peer (msub, &peers[i]); 3041 if (NULL != msub) got_peer (msub, &peers[i]); /* Condition needed? */
3008 if (NULL != cli_ctx->sub) got_peer (cli_ctx->sub, &peers[i]); 3042 if (NULL != cli_ctx->sub) got_peer (cli_ctx->sub, &peers[i]);
3009 } 3043 }
3010 GNUNET_SERVICE_client_continue (cli_ctx->client); 3044 GNUNET_SERVICE_client_continue (cli_ctx->client);
@@ -3179,10 +3213,13 @@ handle_peer_check (void *cls,
3179 3213
3180 LOG (GNUNET_ERROR_TYPE_DEBUG, 3214 LOG (GNUNET_ERROR_TYPE_DEBUG,
3181 "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer)); 3215 "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer));
3182 GNUNET_STATISTICS_update (stats, 3216 if (channel_ctx->peer_ctx->sub == msub)
3183 "# pending online checks", 3217 {
3184 -1, 3218 GNUNET_STATISTICS_update (stats,
3185 GNUNET_NO); 3219 "# pending online checks",
3220 -1,
3221 GNUNET_NO);
3222 }
3186 3223
3187 GNUNET_CADET_receive_done (channel_ctx->channel); 3224 GNUNET_CADET_receive_done (channel_ctx->channel);
3188} 3225}
@@ -3210,7 +3247,10 @@ handle_peer_push (void *cls,
3210 LOG (GNUNET_ERROR_TYPE_DEBUG, 3247 LOG (GNUNET_ERROR_TYPE_DEBUG,
3211 "Received PUSH (%s)\n", 3248 "Received PUSH (%s)\n",
3212 GNUNET_i2s (peer)); 3249 GNUNET_i2s (peer));
3213 GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO); 3250 if (channel_ctx->peer_ctx->sub == msub)
3251 {
3252 GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO);
3253 }
3214 3254
3215 #ifdef ENABLE_MALICIOUS 3255 #ifdef ENABLE_MALICIOUS
3216 struct AttackedPeer *tmp_att_peer; 3256 struct AttackedPeer *tmp_att_peer;
@@ -3271,7 +3311,13 @@ handle_peer_pull_request (void *cls,
3271 (void) msg; 3311 (void) msg;
3272 3312
3273 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); 3313 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer));
3274 GNUNET_STATISTICS_update(stats, "# pull request message received", 1, GNUNET_NO); 3314 if (peer_ctx->sub == msub)
3315 {
3316 GNUNET_STATISTICS_update(stats,
3317 "# pull request message received",
3318 1,
3319 GNUNET_NO);
3320 }
3275 3321
3276 #ifdef ENABLE_MALICIOUS 3322 #ifdef ENABLE_MALICIOUS
3277 if (1 == mal_type 3323 if (1 == mal_type
@@ -3338,10 +3384,13 @@ check_peer_pull_reply (void *cls,
3338 LOG (GNUNET_ERROR_TYPE_WARNING, 3384 LOG (GNUNET_ERROR_TYPE_WARNING,
3339 "Received a pull reply from a peer (%s) we didn't request one from!\n", 3385 "Received a pull reply from a peer (%s) we didn't request one from!\n",
3340 GNUNET_i2s (&sender_ctx->peer_id)); 3386 GNUNET_i2s (&sender_ctx->peer_id));
3341 GNUNET_STATISTICS_update (stats, 3387 if (sender_ctx->sub == msub)
3342 "# unrequested pull replies", 3388 {
3343 1, 3389 GNUNET_STATISTICS_update (stats,
3344 GNUNET_NO); 3390 "# unrequested pull replies",
3391 1,
3392 GNUNET_NO);
3393 }
3345 GNUNET_break_op (0); 3394 GNUNET_break_op (0);
3346 return GNUNET_SYSERR; 3395 return GNUNET_SYSERR;
3347 } 3396 }
@@ -3368,7 +3417,13 @@ handle_peer_pull_reply (void *cls,
3368#endif /* ENABLE_MALICIOUS */ 3417#endif /* ENABLE_MALICIOUS */
3369 3418
3370 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REPLY (%s)\n", GNUNET_i2s (sender)); 3419 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REPLY (%s)\n", GNUNET_i2s (sender));
3371 GNUNET_STATISTICS_update(stats, "# pull reply messages received", 1, GNUNET_NO); 3420 if (channel_ctx->peer_ctx->sub == msub)
3421 {
3422 GNUNET_STATISTICS_update (stats,
3423 "# pull reply messages received",
3424 1,
3425 GNUNET_NO);
3426 }
3372 3427
3373 #ifdef ENABLE_MALICIOUS 3428 #ifdef ENABLE_MALICIOUS
3374 // We shouldn't even receive pull replies as we're not sending 3429 // We shouldn't even receive pull replies as we're not sending
@@ -3508,7 +3563,13 @@ send_pull_request (struct PeerContext *peer_ctx)
3508 3563
3509 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); 3564 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST);
3510 send_message (peer_ctx, ev, "PULL REQUEST"); 3565 send_message (peer_ctx, ev, "PULL REQUEST");
3511 GNUNET_STATISTICS_update(stats, "# pull request send issued", 1, GNUNET_NO); 3566 if (peer_ctx->sub)
3567 {
3568 GNUNET_STATISTICS_update (stats,
3569 "# pull request send issued",
3570 1,
3571 GNUNET_NO);
3572 }
3512} 3573}
3513 3574
3514 3575
@@ -3528,7 +3589,13 @@ send_push (struct PeerContext *peer_ctx)
3528 3589
3529 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PUSH); 3590 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PUSH);
3530 send_message (peer_ctx, ev, "PUSH"); 3591 send_message (peer_ctx, ev, "PUSH");
3531 GNUNET_STATISTICS_update(stats, "# push send issued", 1, GNUNET_NO); 3592 if (peer_ctx->sub)
3593 {
3594 GNUNET_STATISTICS_update (stats,
3595 "# push send issued",
3596 1,
3597 GNUNET_NO);
3598 }
3532} 3599}
3533 3600
3534 3601
@@ -3583,6 +3650,7 @@ handle_client_act_malicious (void *cls,
3583 uint32_t num_mal_peers_old; 3650 uint32_t num_mal_peers_old;
3584 struct Sub *sub = cli_ctx->sub; 3651 struct Sub *sub = cli_ctx->sub;
3585 3652
3653 if (NULL == sub) sub = msub;
3586 /* Do actual logic */ 3654 /* Do actual logic */
3587 peers = (struct GNUNET_PeerIdentity *) &msg[1]; 3655 peers = (struct GNUNET_PeerIdentity *) &msg[1];
3588 mal_type = ntohl (msg->type); 3656 mal_type = ntohl (msg->type);
@@ -3613,15 +3681,9 @@ handle_client_act_malicious (void *cls,
3613 mal_peer_set); 3681 mal_peer_set);
3614 3682
3615 /* Substitute do_round () with do_mal_round () */ 3683 /* Substitute do_round () with do_mal_round () */
3616 if (NULL != sub) 3684 GNUNET_assert (NULL != sub->do_round_task);
3617 { 3685 GNUNET_SCHEDULER_cancel (sub->do_round_task);
3618 GNUNET_SCHEDULER_cancel (sub->do_round_task); 3686 sub->do_round_task = GNUNET_SCHEDULER_add_now (&do_mal_round, sub);
3619 sub->do_round_task = GNUNET_SCHEDULER_add_now (&do_mal_round, sub);
3620 }
3621 else
3622 {
3623 LOG (GNUNET_ERROR_TYPE_WARNING, "do_round_task is NULL, probably in shutdown\n");
3624 }
3625 } 3687 }
3626 3688
3627 else if ( (2 == mal_type) || 3689 else if ( (2 == mal_type) ||
@@ -3653,8 +3715,7 @@ handle_client_act_malicious (void *cls,
3653 &msg->attacked_peer, 3715 &msg->attacked_peer,
3654 sizeof (struct GNUNET_PeerIdentity)); 3716 sizeof (struct GNUNET_PeerIdentity));
3655 /* Set the flag of the attacked peer to valid to avoid problems */ 3717 /* Set the flag of the attacked peer to valid to avoid problems */
3656 if (NULL != sub && 3718 if (GNUNET_NO == check_peer_known (sub->peer_map, &attacked_peer))
3657 GNUNET_NO == check_peer_known (sub->peer_map, &attacked_peer))
3658 { 3719 {
3659 (void) issue_peer_online_check (sub, &attacked_peer); 3720 (void) issue_peer_online_check (sub, &attacked_peer);
3660 } 3721 }
@@ -3664,7 +3725,7 @@ handle_client_act_malicious (void *cls,
3664 GNUNET_i2s (&attacked_peer)); 3725 GNUNET_i2s (&attacked_peer));
3665 3726
3666 /* Substitute do_round () with do_mal_round () */ 3727 /* Substitute do_round () with do_mal_round () */
3667 if (NULL != sub && NULL != sub->do_round_task) 3728 if (NULL != sub->do_round_task)
3668 { 3729 {
3669 /* Probably in shutdown */ 3730 /* Probably in shutdown */
3670 GNUNET_SCHEDULER_cancel (sub->do_round_task); 3731 GNUNET_SCHEDULER_cancel (sub->do_round_task);
@@ -3822,6 +3883,7 @@ do_mal_round (void *cls)
3822} 3883}
3823#endif /* ENABLE_MALICIOUS */ 3884#endif /* ENABLE_MALICIOUS */
3824 3885
3886
3825/** 3887/**
3826 * Send out PUSHes and PULLs, possibly update #view, samplers. 3888 * Send out PUSHes and PULLs, possibly update #view, samplers.
3827 * 3889 *
@@ -3845,7 +3907,10 @@ do_round (void *cls)
3845 3907
3846 LOG (GNUNET_ERROR_TYPE_DEBUG, 3908 LOG (GNUNET_ERROR_TYPE_DEBUG,
3847 "Going to execute next round.\n"); 3909 "Going to execute next round.\n");
3848 GNUNET_STATISTICS_update(stats, "# rounds", 1, GNUNET_NO); 3910 if (sub == msub)
3911 {
3912 GNUNET_STATISTICS_update (stats, "# rounds", 1, GNUNET_NO);
3913 }
3849 sub->do_round_task = NULL; 3914 sub->do_round_task = NULL;
3850 LOG (GNUNET_ERROR_TYPE_DEBUG, 3915 LOG (GNUNET_ERROR_TYPE_DEBUG,
3851 "Printing view:\n"); 3916 "Printing view:\n");
@@ -4019,37 +4084,43 @@ do_round (void *cls)
4019 clients_notify_view_update (sub); 4084 clients_notify_view_update (sub);
4020 } else { 4085 } else {
4021 LOG (GNUNET_ERROR_TYPE_DEBUG, "No update of the view.\n"); 4086 LOG (GNUNET_ERROR_TYPE_DEBUG, "No update of the view.\n");
4022 GNUNET_STATISTICS_update(stats, "# rounds blocked", 1, GNUNET_NO); 4087 if (sub == msub)
4023 if (CustomPeerMap_size (sub->push_map) > alpha * View_size (sub->view) && 4088 {
4024 !(0 >= CustomPeerMap_size (sub->pull_map))) 4089 GNUNET_STATISTICS_update(stats, "# rounds blocked", 1, GNUNET_NO);
4025 GNUNET_STATISTICS_update(stats, "# rounds blocked - too many pushes", 1, GNUNET_NO); 4090 if (CustomPeerMap_size (sub->push_map) > alpha * View_size (sub->view) &&
4026 if (CustomPeerMap_size (sub->push_map) > alpha * View_size (sub->view) && 4091 !(0 >= CustomPeerMap_size (sub->pull_map)))
4027 (0 >= CustomPeerMap_size (sub->pull_map))) 4092 GNUNET_STATISTICS_update(stats, "# rounds blocked - too many pushes", 1, GNUNET_NO);
4028 GNUNET_STATISTICS_update(stats, "# rounds blocked - too many pushes, no pull replies", 1, GNUNET_NO); 4093 if (CustomPeerMap_size (sub->push_map) > alpha * View_size (sub->view) &&
4029 if (0 >= CustomPeerMap_size (sub->push_map) && 4094 (0 >= CustomPeerMap_size (sub->pull_map)))
4030 !(0 >= CustomPeerMap_size (sub->pull_map))) 4095 GNUNET_STATISTICS_update(stats, "# rounds blocked - too many pushes, no pull replies", 1, GNUNET_NO);
4031 GNUNET_STATISTICS_update(stats, "# rounds blocked - no pushes", 1, GNUNET_NO); 4096 if (0 >= CustomPeerMap_size (sub->push_map) &&
4032 if (0 >= CustomPeerMap_size (sub->push_map) && 4097 !(0 >= CustomPeerMap_size (sub->pull_map)))
4033 (0 >= CustomPeerMap_size (sub->pull_map))) 4098 GNUNET_STATISTICS_update(stats, "# rounds blocked - no pushes", 1, GNUNET_NO);
4034 GNUNET_STATISTICS_update(stats, "# rounds blocked - no pushes, no pull replies", 1, GNUNET_NO); 4099 if (0 >= CustomPeerMap_size (sub->push_map) &&
4035 if (0 >= CustomPeerMap_size (sub->pull_map) && 4100 (0 >= CustomPeerMap_size (sub->pull_map)))
4036 CustomPeerMap_size (sub->push_map) > alpha * View_size (sub->view) && 4101 GNUNET_STATISTICS_update(stats, "# rounds blocked - no pushes, no pull replies", 1, GNUNET_NO);
4037 0 >= CustomPeerMap_size (sub->push_map)) 4102 if (0 >= CustomPeerMap_size (sub->pull_map) &&
4038 GNUNET_STATISTICS_update(stats, "# rounds blocked - no pull replies", 1, GNUNET_NO); 4103 CustomPeerMap_size (sub->push_map) > alpha * View_size (sub->view) &&
4104 0 >= CustomPeerMap_size (sub->push_map))
4105 GNUNET_STATISTICS_update(stats, "# rounds blocked - no pull replies", 1, GNUNET_NO);
4106 }
4039 } 4107 }
4040 // TODO independent of that also get some peers from CADET_get_peers()? 4108 // TODO independent of that also get some peers from CADET_get_peers()?
4041 GNUNET_STATISTICS_set (stats, 4109 if (sub == msub)
4042 "# peers in push map at end of round", 4110 {
4043 CustomPeerMap_size (sub->push_map), 4111 GNUNET_STATISTICS_set (stats,
4044 GNUNET_NO); 4112 "# peers in push map at end of round",
4045 GNUNET_STATISTICS_set (stats, 4113 CustomPeerMap_size (sub->push_map),
4046 "# peers in pull map at end of round", 4114 GNUNET_NO);
4047 CustomPeerMap_size (sub->pull_map), 4115 GNUNET_STATISTICS_set (stats,
4048 GNUNET_NO); 4116 "# peers in pull map at end of round",
4049 GNUNET_STATISTICS_set (stats, 4117 CustomPeerMap_size (sub->pull_map),
4050 "# peers in view at end of round", 4118 GNUNET_NO);
4051 View_size (sub->view), 4119 GNUNET_STATISTICS_set (stats,
4052 GNUNET_NO); 4120 "# peers in view at end of round",
4121 View_size (sub->view),
4122 GNUNET_NO);
4123 }
4053 4124
4054 LOG (GNUNET_ERROR_TYPE_DEBUG, 4125 LOG (GNUNET_ERROR_TYPE_DEBUG,
4055 "Received %u pushes and %u pulls last round (alpha (%.2f) * view_size (sub->view%u) = %.2f)\n", 4126 "Received %u pushes and %u pulls last round (alpha (%.2f) * view_size (sub->view%u) = %.2f)\n",
@@ -4085,10 +4156,13 @@ do_round (void *cls)
4085 CustomPeerMap_clear (sub->push_map); 4156 CustomPeerMap_clear (sub->push_map);
4086 CustomPeerMap_clear (sub->pull_map); 4157 CustomPeerMap_clear (sub->pull_map);
4087 4158
4088 GNUNET_STATISTICS_set (stats, 4159 if (sub == msub)
4089 "view size", 4160 {
4090 View_size(sub->view), 4161 GNUNET_STATISTICS_set (stats,
4091 GNUNET_NO); 4162 "view size",
4163 View_size(sub->view),
4164 GNUNET_NO);
4165 }
4092 4166
4093 struct GNUNET_TIME_Relative time_next_round; 4167 struct GNUNET_TIME_Relative time_next_round;
4094 4168