From f992fd2bc8ffa761d02549c1da8df4cb6e1877bc Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Mon, 13 Jun 2016 22:46:05 +0000 Subject: -rps: merge duplicate functions --- src/rps/gnunet-service-rps.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/rps/gnunet-service-rps.c') diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index feffe2ba1..4e24c6231 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -466,7 +466,7 @@ insert_in_view (const struct GNUNET_PeerIdentity *peer) if ( (GNUNET_NO == online) || (GNUNET_SYSERR == online) ) /* peer is not even known */ { - (void) Peers_check_peer_live (peer); + (void) Peers_issue_peer_liveliness_check (peer); (void) Peers_schedule_operation (peer, insert_in_view_op); return GNUNET_NO; } @@ -704,11 +704,10 @@ insert_in_sampler (void *cls, if (0 < RPS_sampler_count_id (prot_sampler, peer)) { /* Make sure we 'know' about this peer */ - (void) Peers_check_peer_live (peer); + (void) Peers_issue_peer_liveliness_check (peer); /* Establish a channel towards that peer to indicate we are going to send * messages to it */ - Peers_indicate_sending_intention (peer); - //Peers_issue_peer_liveliness_check (peer); + //Peers_indicate_sending_intention (peer); } } @@ -722,7 +721,7 @@ static void got_peer (const struct GNUNET_PeerIdentity *peer) { /* If we did not know this peer already, insert it into sampler and view */ - if (GNUNET_YES == Peers_check_peer_live (peer)) + if (GNUNET_YES == Peers_issue_peer_liveliness_check (peer)) { Peers_schedule_operation (peer, insert_in_sampler); Peers_schedule_operation (peer, insert_in_view_op); @@ -1417,7 +1416,7 @@ handle_peer_pull_reply (void *cls, &peers[i])) { /* Make sure we 'know' about this peer */ - (void) Peers_check_peer_live (&peers[i]); + (void) Peers_insert_peer (&peers[i]); if (GNUNET_YES == Peers_check_peer_valid (&peers[i])) { @@ -1426,7 +1425,7 @@ handle_peer_pull_reply (void *cls, else { Peers_schedule_operation (&peers[i], insert_in_pull_map); - Peers_issue_peer_liveliness_check (&peers[i]); + (void) Peers_issue_peer_liveliness_check (&peers[i]); } } } @@ -1636,8 +1635,7 @@ handle_client_act_malicious (void *cls, /* Set the flag of the attacked peer to valid to avoid problems */ if (GNUNET_NO == Peers_check_peer_known (&attacked_peer)) { - Peers_check_peer_live (&attacked_peer); - Peers_issue_peer_liveliness_check (&attacked_peer); + (void) Peers_issue_peer_liveliness_check (&attacked_peer); } LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1727,7 +1725,7 @@ do_mal_round (void *cls) * Send as many pushes to the attacked peer as possible * That is one push per round as it will ignore more. */ - Peers_check_peer_live (&attacked_peer); + (void) Peers_issue_peer_liveliness_check (&attacked_peer); if (GNUNET_YES == Peers_check_peer_valid (&attacked_peer)) send_push (&attacked_peer); } @@ -1739,7 +1737,7 @@ do_mal_round (void *cls) /* Send PUSH to attacked peers */ if (GNUNET_YES == Peers_check_peer_known (&attacked_peer)) { - Peers_check_peer_live (&attacked_peer); + (void) Peers_issue_peer_liveliness_check (&attacked_peer); if (GNUNET_YES == Peers_check_peer_valid (&attacked_peer)) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1747,12 +1745,8 @@ do_mal_round (void *cls) GNUNET_i2s (&attacked_peer)); send_push (&attacked_peer); } - else - Peers_issue_peer_liveliness_check (&attacked_peer); } - else - Peers_check_peer_live (&attacked_peer); - Peers_issue_peer_liveliness_check (&attacked_peer); + (void) Peers_issue_peer_liveliness_check (&attacked_peer); /* The maximum of pushes we're going to send this round */ num_pushes = GNUNET_MIN (GNUNET_MIN (push_limit - 1, -- cgit v1.2.3