gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 03/07: rps tests: check whether peer was scheduled


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 03/07: rps tests: check whether peer was scheduled to go off/online
Date: Sun, 07 Jan 2018 22:33:28 +0100

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a commit to branch master
in repository gnunet.

commit 92b5bc1b168adda55e192f5b5faba8a13874f38b
Author: Julius Bünger <address@hidden>
AuthorDate: Sun Jan 7 22:05:52 2018 +0100

    rps tests: check whether peer was scheduled to go off/online
---
 src/rps/test_rps.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 1e8d4eb55..992b4dc54 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -218,6 +218,11 @@ struct RPSPeer
    * Number of received PeerIDs
    */
   unsigned int num_recv_ids;
+
+  /**
+   * Pending operation on that peer
+   */
+  const struct OpListEntry *entry_op_manage;
 };
 
 
@@ -1200,6 +1205,7 @@ churn_cb (void *cls,
   }
 
   GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
+  rps_peers[entry->index].entry_op_manage = NULL;
   GNUNET_free (entry);
   //if (num_peers_in_round[current_round] == peers_running)
   //  run_round ();
@@ -1222,6 +1228,14 @@ manage_service_wrapper (unsigned int i, unsigned int j, 
int delta,
   struct OpListEntry *entry;
   uint32_t prob;
 
+  GNUNET_assert (GNUNET_YES == rps_peers[j].online);
+
+  /* make sure that management operation is not already scheduled */
+  if (NULL != rps_peers[j].entry_op_manage)
+  {
+    return;
+  }
+
   prob = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
                                    UINT32_MAX);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1253,6 +1267,7 @@ manage_service_wrapper (unsigned int i, unsigned int j, 
int delta,
                                                     entry,
                                                     (0 > delta) ? 0 : 1);
   }
+  rps_peers[j].entry_op_manage = entry;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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