-must notify client on timeout
[oweals/gnunet.git] / src / peerinfo / perf_peerinfo_api.c
old mode 100755 (executable)
new mode 100644 (file)
index 01d87b4..cfd5561
@@ -20,7 +20,9 @@
 
 /**
  * @file peerinfo/perf_peerinfo_api.c
- * @brief testcase for peerinfo_api.c, hopefully hammer the peerinfo service
+ * @brief testcase for peerinfo_api.c, hopefully hammer the peerinfo service,
+ * this performance test adds up to 5000 peers with one address each and checks
+ * over how many peers it can iterate before receiving a timeout after 30 seconds
  * @author Nathan Evans
  */
 
@@ -53,16 +55,16 @@ check_it (void *cls, const struct GNUNET_HELLO_Address *address,
 }
 
 
-static size_t
+static ssize_t
 address_generator (void *cls, size_t max, void *buf)
 {
   size_t *agc = cls;
-  size_t ret;
+  ssize_t ret;
   char *caddress;
   struct GNUNET_HELLO_Address address;
 
   if (*agc == 0)
-    return 0;
+    return GNUNET_SYSERR; /* Done */
 
   GNUNET_asprintf (&caddress, "Address%d", *agc);
   address.peer = pid;
@@ -82,12 +84,10 @@ address_generator (void *cls, size_t max, void *buf)
 static void
 add_peer (size_t i)
 {
-  struct GNUNET_CRYPTO_EccPublicSignKey pkey;
   struct GNUNET_HELLO_Message *h2;
 
-  memset (&pkey, i, sizeof (pkey));
-  GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey);
-  h2 = GNUNET_HELLO_create (&pkey, &address_generator, &i, GNUNET_NO);
+  memset (&pid, i, sizeof (pid));
+  h2 = GNUNET_HELLO_create (&pid.public_key, &address_generator, &i, GNUNET_NO);
   GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
   GNUNET_free (h2);
 }
@@ -108,7 +108,7 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
 
 
 static void
-run (void *cls, 
+run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *cfg,
      struct GNUNET_TESTING_Peer *peer)
 {