summaryrefslogtreecommitdiff
path: root/src/rps/test_rps.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-08-03 20:45:26 +0000
committerJulius Bünger <buenger@mytum.de>2015-08-03 20:45:26 +0000
commit7da3754925a744ae68b6911e58f02dd099b06297 (patch)
tree3b7cc04c4ac31990afab80132d5dd28fab1749ee /src/rps/test_rps.c
parent113ffe7f6ccbbfec1e18cff41004c7b65242a5f9 (diff)
downloadgnunet-7da3754925a744ae68b6911e58f02dd099b06297.tar.gz
gnunet-7da3754925a744ae68b6911e58f02dd099b06297.zip
-mark ops as done + don't start connect all clients
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r--src/rps/test_rps.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 146be4c2c..f6c7ec205 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -501,8 +501,9 @@ shutdown_op (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
501 if (NULL != churn_task) 501 if (NULL != churn_task)
502 GNUNET_SCHEDULER_cancel (churn_task); 502 GNUNET_SCHEDULER_cancel (churn_task);
503 503
504 for (i = 0 ; i < num_peers ; i++) 504 for (i = 0; i < num_peers; i++)
505 GNUNET_TESTBED_operation_done (rps_peers[i].op); 505 if (NULL != rps_peers[i].op)
506 GNUNET_TESTBED_operation_done (rps_peers[i].op);
506 GNUNET_SCHEDULER_shutdown (); 507 GNUNET_SCHEDULER_shutdown ();
507} 508}
508 509
@@ -544,6 +545,7 @@ info_cb (void *cb_cls,
544 if (NULL == pinfo || NULL != emsg) 545 if (NULL == pinfo || NULL != emsg)
545 { 546 {
546 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg); 547 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg);
548 GNUNET_TESTBED_operation_done (entry->op);
547 return; 549 return;
548 } 550 }
549 551
@@ -554,8 +556,6 @@ info_cb (void *cb_cls,
554 556
555 rps_peer_ids[entry->index] = *(pinfo->result.id); 557 rps_peer_ids[entry->index] = *(pinfo->result.id);
556 rps_peers[entry->index].peer_id = &rps_peer_ids[entry->index]; 558 rps_peers[entry->index].peer_id = &rps_peer_ids[entry->index];
557 rps_peers[entry->index].rec_ids = NULL;
558 rps_peers[entry->index].num_rec_ids = 0;
559 559
560 GNUNET_CONTAINER_multipeermap_put (peer_map, 560 GNUNET_CONTAINER_multipeermap_put (peer_map,
561 &rps_peer_ids[entry->index], 561 &rps_peer_ids[entry->index],
@@ -566,11 +566,8 @@ info_cb (void *cb_cls,
566 entry->index, 566 entry->index,
567 GNUNET_i2s_full (&rps_peer_ids[entry->index])); 567 GNUNET_i2s_full (&rps_peer_ids[entry->index]));
568 568
569 if (NULL != cur_test_run.init_peer)
570 cur_test_run.init_peer (&rps_peers[entry->index]);
571
572 GNUNET_TESTBED_operation_done (entry->op);
573 GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry); 569 GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
570 GNUNET_TESTBED_operation_done (entry->op);
574 GNUNET_free (entry); 571 GNUNET_free (entry);
575} 572}
576 573
@@ -1312,32 +1309,41 @@ run (void *cls,
1312{ 1309{
1313 unsigned int i; 1310 unsigned int i;
1314 struct OpListEntry *entry; 1311 struct OpListEntry *entry;
1312 uint32_t num_mal_peers;
1315 1313
1316 testbed_peers = peers; 1314 testbed_peers = peers;
1317 num_peers_online = 0; 1315 num_peers_online = 0;
1318 for (i = 0 ; i < num_peers ; i++) 1316 for (i = 0; i < num_peers; i++)
1319 { 1317 {
1320 entry = make_oplist_entry (); 1318 entry = make_oplist_entry ();
1321 entry->index = i; 1319 entry->index = i;
1320 rps_peers[i].index = i;
1321 if (NULL != cur_test_run.init_peer)
1322 cur_test_run.init_peer (&rps_peers[i]);
1322 entry->op = GNUNET_TESTBED_peer_get_information (peers[i], 1323 entry->op = GNUNET_TESTBED_peer_get_information (peers[i],
1323 GNUNET_TESTBED_PIT_IDENTITY, 1324 GNUNET_TESTBED_PIT_IDENTITY,
1324 &info_cb, 1325 &info_cb,
1325 entry); 1326 entry);
1326 } 1327 }
1327 1328
1329 num_mal_peers = round (portion * num_peers);
1328 GNUNET_assert (num_peers == n_peers); 1330 GNUNET_assert (num_peers == n_peers);
1329 for (i = 0 ; i < n_peers ; i++) 1331 for (i = 0; i < n_peers; i++)
1330 { 1332 {
1331 rps_peers[i].index = i; 1333 rps_peers[i].index = i;
1332 rps_peers[i].op = 1334 if ( (rps_peers[i].num_recv_ids < rps_peers[i].num_ids_to_request) ||
1333 GNUNET_TESTBED_service_connect (&rps_peers[i], 1335 (i < num_mal_peers) )
1334 peers[i], 1336 {
1335 "rps", 1337 rps_peers[i].op =
1336 &rps_connect_complete_cb, 1338 GNUNET_TESTBED_service_connect (&rps_peers[i],
1337 &rps_peers[i], 1339 peers[i],
1338 &rps_connect_adapter, 1340 "rps",
1339 &rps_disconnect_adapter, 1341 &rps_connect_complete_cb,
1340 &rps_peers[i]); 1342 &rps_peers[i],
1343 &rps_connect_adapter,
1344 &rps_disconnect_adapter,
1345 &rps_peers[i]);
1346 }
1341 } 1347 }
1342 1348
1343 if (NULL != churn_task) 1349 if (NULL != churn_task)