diff options
author | Julius Bünger <buenger@mytum.de> | 2015-12-01 18:25:37 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-12-01 18:25:37 +0000 |
commit | 1b49510e7736620d7e10a33326076e2d75c86943 (patch) | |
tree | 0c4c53931fb84f300c825ed3d36f0337956b3466 /src/rps | |
parent | 5c72cf0b8a2ab24254ec9e14d7149a05332eb475 (diff) | |
download | gnunet-1b49510e7736620d7e10a33326076e2d75c86943.tar.gz gnunet-1b49510e7736620d7e10a33326076e2d75c86943.zip |
-removed obsolete functions
Signed-off-by: Julius Bünger <buenger@mytum.de>
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index f3fb37c68..fbf42a808 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -67,11 +67,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
67 | static struct GNUNET_PeerIdentity own_identity; | 67 | static struct GNUNET_PeerIdentity own_identity; |
68 | 68 | ||
69 | 69 | ||
70 | struct GNUNET_PeerIdentity * | ||
71 | get_rand_peer_ignore_list (const struct GNUNET_PeerIdentity *peer_list, unsigned int size, | ||
72 | const struct GNUNET_PeerIdentity *ignore_list, unsigned int ignore_size); | ||
73 | |||
74 | |||
75 | /*********************************************************************** | 70 | /*********************************************************************** |
76 | * Housekeeping with peers | 71 | * Housekeeping with peers |
77 | ***********************************************************************/ | 72 | ***********************************************************************/ |
@@ -544,30 +539,6 @@ peer_clean (const struct GNUNET_PeerIdentity *peer); | |||
544 | 539 | ||
545 | 540 | ||
546 | /** | 541 | /** |
547 | * Check if peer is already in peer array. | ||
548 | */ | ||
549 | int | ||
550 | in_arr (const struct GNUNET_PeerIdentity *array, | ||
551 | unsigned int arr_size, | ||
552 | const struct GNUNET_PeerIdentity *peer) | ||
553 | { | ||
554 | GNUNET_assert (NULL != peer); | ||
555 | |||
556 | if (0 == arr_size) | ||
557 | return GNUNET_NO; | ||
558 | |||
559 | GNUNET_assert (NULL != array); | ||
560 | |||
561 | unsigned int i; | ||
562 | |||
563 | for (i = 0; i < arr_size ; i++) | ||
564 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (&array[i], peer)) | ||
565 | return GNUNET_YES; | ||
566 | return GNUNET_NO; | ||
567 | } | ||
568 | |||
569 | |||
570 | /** | ||
571 | * Print peerlist to log. | 542 | * Print peerlist to log. |
572 | */ | 543 | */ |
573 | void | 544 | void |
@@ -622,67 +593,6 @@ rem_from_list (struct GNUNET_PeerIdentity **peer_list, | |||
622 | *peer_list = tmp; | 593 | *peer_list = tmp; |
623 | } | 594 | } |
624 | 595 | ||
625 | /** | ||
626 | * Get random peer from the given list but don't return one from the @a ignore_list. | ||
627 | */ | ||
628 | struct GNUNET_PeerIdentity * | ||
629 | get_rand_peer_ignore_list (const struct GNUNET_PeerIdentity *peer_list, | ||
630 | uint32_t list_size, | ||
631 | const struct GNUNET_PeerIdentity *ignore_list, | ||
632 | uint32_t ignore_size) | ||
633 | { | ||
634 | uint32_t r_index; | ||
635 | uint32_t tmp_size; | ||
636 | struct GNUNET_PeerIdentity *tmp_peer_list; | ||
637 | struct GNUNET_PeerIdentity *peer; | ||
638 | |||
639 | GNUNET_assert (NULL != peer_list); | ||
640 | if (0 == list_size) | ||
641 | return NULL; | ||
642 | |||
643 | tmp_size = 0; | ||
644 | tmp_peer_list = NULL; | ||
645 | GNUNET_array_grow (tmp_peer_list, tmp_size, list_size); | ||
646 | memcpy (tmp_peer_list, | ||
647 | peer_list, | ||
648 | list_size * sizeof (struct GNUNET_PeerIdentity)); | ||
649 | peer = GNUNET_new (struct GNUNET_PeerIdentity); | ||
650 | |||
651 | /**; | ||
652 | * Choose the r_index of the peer we want to return | ||
653 | * at random from the interval of the view | ||
654 | */ | ||
655 | r_index = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, | ||
656 | tmp_size); | ||
657 | *peer = tmp_peer_list[r_index]; | ||
658 | |||
659 | while (in_arr (ignore_list, ignore_size, peer)) | ||
660 | { | ||
661 | rem_from_list (&tmp_peer_list, &tmp_size, peer); | ||
662 | |||
663 | print_peer_list (tmp_peer_list, tmp_size); | ||
664 | |||
665 | if (0 == tmp_size) | ||
666 | { | ||
667 | GNUNET_free (peer); | ||
668 | return NULL; | ||
669 | } | ||
670 | |||
671 | /**; | ||
672 | * Choose the r_index of the peer we want to return | ||
673 | * at random from the interval of the view | ||
674 | */ | ||
675 | r_index = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, | ||
676 | tmp_size); | ||
677 | *peer = tmp_peer_list[r_index]; | ||
678 | } | ||
679 | |||
680 | |||
681 | GNUNET_array_grow (tmp_peer_list, tmp_size, 0); | ||
682 | |||
683 | return peer; | ||
684 | } | ||
685 | |||
686 | 596 | ||
687 | /** | 597 | /** |
688 | * Get the context of a peer. If not existing, create. | 598 | * Get the context of a peer. If not existing, create. |