gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11015 - gnunet/src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r11015 - gnunet/src/peerinfo
Date: Wed, 21 Apr 2010 21:57:04 +0200

Author: grothoff
Date: 2010-04-21 21:57:04 +0200 (Wed, 21 Apr 2010)
New Revision: 11015

Modified:
   gnunet/src/peerinfo/test_peerinfo_api.c
Log:
migrating testcase

Modified: gnunet/src/peerinfo/test_peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/test_peerinfo_api.c     2010-04-21 19:52:54 UTC (rev 
11014)
+++ gnunet/src/peerinfo/test_peerinfo_api.c     2010-04-21 19:57:04 UTC (rev 
11015)
@@ -40,8 +40,10 @@
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-static struct GNUNET_PEERINFO_IteratorContext *ic;
+static struct GNUNET_PEERINFO_NewIteratorContext *ic;
 
+static struct GNUNET_PEERINFO_Handle *h;
+
 static unsigned int retries;
 
 static int
@@ -91,7 +93,7 @@
   memset (&pkey, 32, sizeof (pkey));
   GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey);
   h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc);
-  GNUNET_PEERINFO_add_peer (cfg, sched, &pid, h2);
+  GNUNET_PEERINFO_add_peer_new (h, h2);
   GNUNET_free (h2);
 
 }
@@ -114,18 +116,19 @@
          /* try again */
          retries++;      
          add_peer ();
-         ic = GNUNET_PEERINFO_iterate (cfg,
-                                       sched,
-                                       NULL,
-                                       0,
-                                       GNUNET_TIME_relative_multiply
-                                       (GNUNET_TIME_UNIT_SECONDS, 15), 
-                                       &process, cls);
+         ic = GNUNET_PEERINFO_iterate_new (h,
+                                           NULL,
+                                           0,
+                                           GNUNET_TIME_relative_multiply
+                                           (GNUNET_TIME_UNIT_SECONDS, 15), 
+                                           &process, cls);
          return;
        }
       GNUNET_assert (peer == NULL);
       GNUNET_assert (2 == *ok);
       GNUNET_assert (trust == 0);
+      GNUNET_PEERINFO_disconnect (h);
+      h = NULL;
       *ok = 0;
       return;
     }
@@ -149,13 +152,14 @@
 {
   sched = s;
   cfg = c;
+  h = GNUNET_PEERINFO_connect (cfg, sched);
   add_peer ();
-  ic = GNUNET_PEERINFO_iterate (cfg,
-                               sched,
-                               NULL,
-                               0,
-                               GNUNET_TIME_relative_multiply
-                               (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls);
+  ic = GNUNET_PEERINFO_iterate_new (h,
+                                   NULL,
+                                   0,
+                                   GNUNET_TIME_relative_multiply
+                                   (GNUNET_TIME_UNIT_SECONDS, 15),
+                                   &process, cls);
 }
 
 





reply via email to

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