we probably want to actually test the sync
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Fri, 11 Oct 2019 19:37:41 +0000 (21:37 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Fri, 11 Oct 2019 19:37:41 +0000 (21:37 +0200)
src/peerstore/test_peerstore_api_sync.c

index 503cb2f1e485eaefe584bec4cf760cc4641df74f..bfeae6ed8931ef8efaaee8acbdf57ce888dd6909 100644 (file)
@@ -109,6 +109,7 @@ iterate_cb (void *cls,
 static void
 test_cont (void *cls)
 {
+  h = GNUNET_PEERSTORE_connect (cfg);
   GNUNET_PEERSTORE_iterate (h,
                             subsystem,
                             &pid, key,
@@ -116,6 +117,16 @@ test_cont (void *cls)
                             NULL);
 }
 
+static void
+disc_cont (void *cls)
+{
+  GNUNET_PEERSTORE_disconnect (h, GNUNET_YES);
+  h = NULL;
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+                                &test_cont,
+                                NULL);
+}
+
 static void
 store_cont (void *cls, int success)
 {
@@ -125,9 +136,8 @@ store_cont (void *cls, int success)
      the test may fail non-deterministically if the new
      connection is faster than the cleanup routine of the
      old one. */
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                &test_cont,
-                                NULL);
+  GNUNET_SCHEDULER_add_now (&disc_cont,
+                            NULL);
 }
 
 /**