diff options
author | Julius Bünger <buenger@mytum.de> | 2015-05-19 22:41:45 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-05-19 22:41:45 +0000 |
commit | c8a94577fe87d86aa1537e85e5e294e80c64f356 (patch) | |
tree | 93ef26586c3d89b32513b5bd257d2a7539acabc6 /src/rps/test_rps.c | |
parent | e8e1d794756b917bfdbe9f6ce163b7898852bf13 (diff) | |
download | gnunet-c8a94577fe87d86aa1537e85e5e294e80c64f356.tar.gz gnunet-c8a94577fe87d86aa1537e85e5e294e80c64f356.zip |
-restructured retrieval of information about peer
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r-- | src/rps/test_rps.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 7d437354a..32bce4098 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -438,7 +438,7 @@ info_cb (void *cb_cls, | |||
438 | const struct GNUNET_TESTBED_PeerInformation *pinfo, | 438 | const struct GNUNET_TESTBED_PeerInformation *pinfo, |
439 | const char *emsg) | 439 | const char *emsg) |
440 | { | 440 | { |
441 | unsigned int i = *((unsigned int *) cb_cls); | 441 | struct OpListEntry *entry = (struct OpListEntry *) cb_cls; |
442 | 442 | ||
443 | if (NULL == pinfo || NULL != emsg) | 443 | if (NULL == pinfo || NULL != emsg) |
444 | { | 444 | { |
@@ -446,13 +446,20 @@ info_cb (void *cb_cls, | |||
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | 448 | ||
449 | GNUNET_free (cb_cls); | 449 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
450 | "Peer %u is %s\n", | ||
451 | entry->index, | ||
452 | GNUNET_i2s (pinfo->result.id)); | ||
453 | |||
454 | rps_peer_ids[entry->index] = *(pinfo->result.id); | ||
455 | rps_peers[entry->index].peer_id = &rps_peer_ids[entry->index]; | ||
456 | rps_peers[entry->index].rec_ids = NULL; | ||
457 | rps_peers[entry->index].num_rec_ids = 0; | ||
450 | 458 | ||
451 | rps_peer_ids[i] = *(pinfo->result.id); | 459 | GNUNET_TESTBED_operation_done (entry->op); |
452 | rps_peers[i].peer_id = &rps_peer_ids[i]; | ||
453 | rps_peers[i].rec_ids = NULL; | ||
454 | rps_peers[i].num_rec_ids = 0; | ||
455 | 460 | ||
461 | GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry); | ||
462 | GNUNET_free (entry); | ||
456 | } | 463 | } |
457 | 464 | ||
458 | 465 | ||
@@ -827,7 +834,7 @@ profiler_cb (struct RPSPeer *rps_peer) | |||
827 | * | 834 | * |
828 | * @param cls closure | 835 | * @param cls closure |
829 | * @param h the run handle | 836 | * @param h the run handle |
830 | * @param num_peers number of peers in 'peers' | 837 | * @param n_peers number of peers in 'peers' |
831 | * @param peers handle to peers run in the testbed | 838 | * @param peers handle to peers run in the testbed |
832 | * @param links_succeeded the number of overlay link connection attempts that | 839 | * @param links_succeeded the number of overlay link connection attempts that |
833 | * succeeded | 840 | * succeeded |
@@ -837,30 +844,39 @@ profiler_cb (struct RPSPeer *rps_peer) | |||
837 | static void | 844 | static void |
838 | run (void *cls, | 845 | run (void *cls, |
839 | struct GNUNET_TESTBED_RunHandle *h, | 846 | struct GNUNET_TESTBED_RunHandle *h, |
840 | unsigned int num_peers, | 847 | unsigned int n_peers, |
841 | struct GNUNET_TESTBED_Peer **peers, | 848 | struct GNUNET_TESTBED_Peer **peers, |
842 | unsigned int links_succeeded, | 849 | unsigned int links_succeeded, |
843 | unsigned int links_failed) | 850 | unsigned int links_failed) |
844 | { | 851 | { |
845 | unsigned int i; | 852 | unsigned int i; |
846 | unsigned int *tmp_i; | 853 | struct OpListEntry *entry; |
847 | 854 | ||
848 | testbed_peers = peers; | 855 | testbed_peers = peers; |
849 | num_peers_online = 0; | 856 | num_peers_online = 0; |
850 | 857 | ||
851 | for (i = 0 ; i < NUM_PEERS ; i++) | 858 | for (i = 0 ; i < num_peers ; i++) |
852 | { | 859 | { |
853 | tmp_i = GNUNET_new (unsigned int); | 860 | entry = make_oplist_entry (); |
854 | *tmp_i = i; | 861 | entry->index = i; |
855 | 862 | entry->op = GNUNET_TESTBED_peer_get_information (peers[i], | |
856 | (void) GNUNET_TESTBED_peer_get_information (peers[i], | 863 | GNUNET_TESTBED_PIT_IDENTITY, |
857 | GNUNET_TESTBED_PIT_IDENTITY, | 864 | &info_cb, |
858 | &info_cb, | 865 | entry); |
859 | tmp_i); | ||
860 | } | 866 | } |
861 | 867 | ||
862 | GNUNET_assert (NUM_PEERS == num_peers); | 868 | |
863 | for (i = 0 ; i < num_peers ; i++) | 869 | // This seems not to work |
870 | //if (NULL != strstr (cur_test_run.name, "profiler")) | ||
871 | //{ | ||
872 | // churn_task = GNUNET_SCHEDULER_add_delayed ( | ||
873 | // GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), | ||
874 | // churn, | ||
875 | // NULL); | ||
876 | //} | ||
877 | |||
878 | GNUNET_assert (num_peers == n_peers); | ||
879 | for (i = 0 ; i < n_peers ; i++) | ||
864 | { | 880 | { |
865 | rps_peers[i].index = i; | 881 | rps_peers[i].index = i; |
866 | rps_peers[i].op = | 882 | rps_peers[i].op = |