gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12814 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r12814 - gnunet/src/testing
Date: Thu, 2 Sep 2010 17:56:57 +0200

Author: nevans
Date: 2010-09-02 17:56:57 +0200 (Thu, 02 Sep 2010)
New Revision: 12814

Modified:
   gnunet/src/testing/testing_group.c
Log:
missing definition

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2010-09-02 15:06:42 UTC (rev 12813)
+++ gnunet/src/testing/testing_group.c  2010-09-02 15:56:57 UTC (rev 12814)
@@ -3540,6 +3540,29 @@
     return NULL;
 }
 
+/*
+ * Get a daemon by peer identity, so callers can
+ * retrieve the daemon without knowing it's offset.
+ *
+ * @param pg the peer group to retrieve the daemon from
+ * @param peer_id the peer identity of the daemon to retrieve
+ *
+ * @return the daemon on success, or NULL if no such peer identity is found
+ */
+struct GNUNET_TESTING_Daemon *
+GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg, struct 
GNUNET_PeerIdentity *peer_id)
+{
+  unsigned int i;
+
+  for (i = 0; i < pg->total; i ++)
+    {
+      if (0 == memcmp(&pg->peers[i].daemon->id, peer_id, sizeof(struct 
GNUNET_PeerIdentity)))
+        return pg->peers[i].daemon;
+    }
+
+  return NULL;
+}
+
 /**
  * Prototype of a function that will be called when a
  * particular operation was completed the testing library.




reply via email to

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