gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r36199 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r36199 - gnunet/src/rps
Date: Mon, 3 Aug 2015 22:45:26 +0200

Author: ch3
Date: 2015-08-03 22:45:26 +0200 (Mon, 03 Aug 2015)
New Revision: 36199

Modified:
   gnunet/src/rps/test_rps.c
Log:
-mark ops as done + don't start connect all clients

Modified: gnunet/src/rps/test_rps.c
===================================================================
--- gnunet/src/rps/test_rps.c   2015-08-03 20:45:24 UTC (rev 36198)
+++ gnunet/src/rps/test_rps.c   2015-08-03 20:45:26 UTC (rev 36199)
@@ -501,8 +501,9 @@
   if (NULL != churn_task)
     GNUNET_SCHEDULER_cancel (churn_task);
 
-  for (i = 0 ; i < num_peers ; i++)
-    GNUNET_TESTBED_operation_done (rps_peers[i].op);
+  for (i = 0; i < num_peers; i++)
+    if (NULL != rps_peers[i].op)
+      GNUNET_TESTBED_operation_done (rps_peers[i].op);
   GNUNET_SCHEDULER_shutdown ();
 }
 
@@ -544,6 +545,7 @@
   if (NULL == pinfo || NULL != emsg)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg);
+    GNUNET_TESTBED_operation_done (entry->op);
     return;
   }
 
@@ -554,8 +556,6 @@
 
   rps_peer_ids[entry->index] = *(pinfo->result.id);
   rps_peers[entry->index].peer_id = &rps_peer_ids[entry->index];
-  rps_peers[entry->index].rec_ids = NULL;
-  rps_peers[entry->index].num_rec_ids = 0;
 
   GNUNET_CONTAINER_multipeermap_put (peer_map,
       &rps_peer_ids[entry->index],
@@ -566,11 +566,8 @@
            entry->index,
            GNUNET_i2s_full (&rps_peer_ids[entry->index]));
 
-  if (NULL != cur_test_run.init_peer)
-    cur_test_run.init_peer (&rps_peers[entry->index]);
-
+  GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
   GNUNET_TESTBED_operation_done (entry->op);
-  GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
   GNUNET_free (entry);
 }
 
@@ -1312,13 +1309,17 @@
 {
   unsigned int i;
   struct OpListEntry *entry;
+  uint32_t num_mal_peers;
 
   testbed_peers = peers;
   num_peers_online = 0;
-  for (i = 0 ; i < num_peers ; i++)
+  for (i = 0; i < num_peers; i++)
   {
     entry = make_oplist_entry ();
     entry->index = i;
+    rps_peers[i].index = i;
+    if (NULL != cur_test_run.init_peer)
+      cur_test_run.init_peer (&rps_peers[i]);
     entry->op = GNUNET_TESTBED_peer_get_information (peers[i],
                                                      
GNUNET_TESTBED_PIT_IDENTITY,
                                                      &info_cb,
@@ -1325,19 +1326,24 @@
                                                      entry);
   }
 
+  num_mal_peers = round (portion * num_peers);
   GNUNET_assert (num_peers == n_peers);
-  for (i = 0 ; i < n_peers ; i++)
+  for (i = 0; i < n_peers; i++)
   {
     rps_peers[i].index = i;
-    rps_peers[i].op =
-      GNUNET_TESTBED_service_connect (&rps_peers[i],
-                                      peers[i],
-                                      "rps",
-                                      &rps_connect_complete_cb,
-                                      &rps_peers[i],
-                                      &rps_connect_adapter,
-                                      &rps_disconnect_adapter,
-                                      &rps_peers[i]);
+    if ( (rps_peers[i].num_recv_ids < rps_peers[i].num_ids_to_request) ||
+         (i < num_mal_peers) )
+    {
+      rps_peers[i].op =
+        GNUNET_TESTBED_service_connect (&rps_peers[i],
+                                        peers[i],
+                                        "rps",
+                                        &rps_connect_complete_cb,
+                                        &rps_peers[i],
+                                        &rps_connect_adapter,
+                                        &rps_disconnect_adapter,
+                                        &rps_peers[i]);
+    }
   }
 
   if (NULL != churn_task)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]