aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2016-06-13 22:46:05 +0000
committerJulius Bünger <buenger@mytum.de>2016-06-13 22:46:05 +0000
commitf992fd2bc8ffa761d02549c1da8df4cb6e1877bc (patch)
tree954bb31470cb817a4d259b2ac583a50f671e36ee /src/rps/gnunet-service-rps.c
parent88a38a7538d038b6d0febca509e934aaac4bc6f8 (diff)
downloadgnunet-f992fd2bc8ffa761d02549c1da8df4cb6e1877bc.tar.gz
gnunet-f992fd2bc8ffa761d02549c1da8df4cb6e1877bc.zip
-rps: merge duplicate functions
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r--src/rps/gnunet-service-rps.c26
1 files changed, 10 insertions, 16 deletions
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)
466 if ( (GNUNET_NO == online) || 466 if ( (GNUNET_NO == online) ||
467 (GNUNET_SYSERR == online) ) /* peer is not even known */ 467 (GNUNET_SYSERR == online) ) /* peer is not even known */
468 { 468 {
469 (void) Peers_check_peer_live (peer); 469 (void) Peers_issue_peer_liveliness_check (peer);
470 (void) Peers_schedule_operation (peer, insert_in_view_op); 470 (void) Peers_schedule_operation (peer, insert_in_view_op);
471 return GNUNET_NO; 471 return GNUNET_NO;
472 } 472 }
@@ -704,11 +704,10 @@ insert_in_sampler (void *cls,
704 if (0 < RPS_sampler_count_id (prot_sampler, peer)) 704 if (0 < RPS_sampler_count_id (prot_sampler, peer))
705 { 705 {
706 /* Make sure we 'know' about this peer */ 706 /* Make sure we 'know' about this peer */
707 (void) Peers_check_peer_live (peer); 707 (void) Peers_issue_peer_liveliness_check (peer);
708 /* Establish a channel towards that peer to indicate we are going to send 708 /* Establish a channel towards that peer to indicate we are going to send
709 * messages to it */ 709 * messages to it */
710 Peers_indicate_sending_intention (peer); 710 //Peers_indicate_sending_intention (peer);
711 //Peers_issue_peer_liveliness_check (peer);
712 } 711 }
713} 712}
714 713
@@ -722,7 +721,7 @@ static void
722got_peer (const struct GNUNET_PeerIdentity *peer) 721got_peer (const struct GNUNET_PeerIdentity *peer)
723{ 722{
724 /* If we did not know this peer already, insert it into sampler and view */ 723 /* If we did not know this peer already, insert it into sampler and view */
725 if (GNUNET_YES == Peers_check_peer_live (peer)) 724 if (GNUNET_YES == Peers_issue_peer_liveliness_check (peer))
726 { 725 {
727 Peers_schedule_operation (peer, insert_in_sampler); 726 Peers_schedule_operation (peer, insert_in_sampler);
728 Peers_schedule_operation (peer, insert_in_view_op); 727 Peers_schedule_operation (peer, insert_in_view_op);
@@ -1417,7 +1416,7 @@ handle_peer_pull_reply (void *cls,
1417 &peers[i])) 1416 &peers[i]))
1418 { 1417 {
1419 /* Make sure we 'know' about this peer */ 1418 /* Make sure we 'know' about this peer */
1420 (void) Peers_check_peer_live (&peers[i]); 1419 (void) Peers_insert_peer (&peers[i]);
1421 1420
1422 if (GNUNET_YES == Peers_check_peer_valid (&peers[i])) 1421 if (GNUNET_YES == Peers_check_peer_valid (&peers[i]))
1423 { 1422 {
@@ -1426,7 +1425,7 @@ handle_peer_pull_reply (void *cls,
1426 else 1425 else
1427 { 1426 {
1428 Peers_schedule_operation (&peers[i], insert_in_pull_map); 1427 Peers_schedule_operation (&peers[i], insert_in_pull_map);
1429 Peers_issue_peer_liveliness_check (&peers[i]); 1428 (void) Peers_issue_peer_liveliness_check (&peers[i]);
1430 } 1429 }
1431 } 1430 }
1432 } 1431 }
@@ -1636,8 +1635,7 @@ handle_client_act_malicious (void *cls,
1636 /* Set the flag of the attacked peer to valid to avoid problems */ 1635 /* Set the flag of the attacked peer to valid to avoid problems */
1637 if (GNUNET_NO == Peers_check_peer_known (&attacked_peer)) 1636 if (GNUNET_NO == Peers_check_peer_known (&attacked_peer))
1638 { 1637 {
1639 Peers_check_peer_live (&attacked_peer); 1638 (void) Peers_issue_peer_liveliness_check (&attacked_peer);
1640 Peers_issue_peer_liveliness_check (&attacked_peer);
1641 } 1639 }
1642 1640
1643 LOG (GNUNET_ERROR_TYPE_DEBUG, 1641 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1727,7 +1725,7 @@ do_mal_round (void *cls)
1727 * Send as many pushes to the attacked peer as possible 1725 * Send as many pushes to the attacked peer as possible
1728 * That is one push per round as it will ignore more. 1726 * That is one push per round as it will ignore more.
1729 */ 1727 */
1730 Peers_check_peer_live (&attacked_peer); 1728 (void) Peers_issue_peer_liveliness_check (&attacked_peer);
1731 if (GNUNET_YES == Peers_check_peer_valid (&attacked_peer)) 1729 if (GNUNET_YES == Peers_check_peer_valid (&attacked_peer))
1732 send_push (&attacked_peer); 1730 send_push (&attacked_peer);
1733 } 1731 }
@@ -1739,7 +1737,7 @@ do_mal_round (void *cls)
1739 /* Send PUSH to attacked peers */ 1737 /* Send PUSH to attacked peers */
1740 if (GNUNET_YES == Peers_check_peer_known (&attacked_peer)) 1738 if (GNUNET_YES == Peers_check_peer_known (&attacked_peer))
1741 { 1739 {
1742 Peers_check_peer_live (&attacked_peer); 1740 (void) Peers_issue_peer_liveliness_check (&attacked_peer);
1743 if (GNUNET_YES == Peers_check_peer_valid (&attacked_peer)) 1741 if (GNUNET_YES == Peers_check_peer_valid (&attacked_peer))
1744 { 1742 {
1745 LOG (GNUNET_ERROR_TYPE_DEBUG, 1743 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1747,12 +1745,8 @@ do_mal_round (void *cls)
1747 GNUNET_i2s (&attacked_peer)); 1745 GNUNET_i2s (&attacked_peer));
1748 send_push (&attacked_peer); 1746 send_push (&attacked_peer);
1749 } 1747 }
1750 else
1751 Peers_issue_peer_liveliness_check (&attacked_peer);
1752 } 1748 }
1753 else 1749 (void) Peers_issue_peer_liveliness_check (&attacked_peer);
1754 Peers_check_peer_live (&attacked_peer);
1755 Peers_issue_peer_liveliness_check (&attacked_peer);
1756 1750
1757 /* The maximum of pushes we're going to send this round */ 1751 /* The maximum of pushes we're going to send this round */
1758 num_pushes = GNUNET_MIN (GNUNET_MIN (push_limit - 1, 1752 num_pushes = GNUNET_MIN (GNUNET_MIN (push_limit - 1,