how did this test ever work without assigning core handles?
[oweals/gnunet.git] / src / core / test_core_api.c
index c7865dd11a3ecfbce433c41a611352845a4bb436..348bd89750a0d1a773dde8c2c18dc71200188700 100644 (file)
@@ -264,16 +264,14 @@ connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls, 
              const struct GNUNET_PeerIdentity *my_identity)
 {
   struct PeerContext *p = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core connection to `%4s' established\n",
               GNUNET_i2s (my_identity));
-  GNUNET_assert (server != NULL);
   p->id = *my_identity;
-  p->ch = server;
   if (cls == &p1)
   {
     GNUNET_assert (ok == 2);
@@ -349,8 +347,8 @@ stop_arm (struct PeerContext *p)
 }
 
 
-static int
-check ()
+int
+main (int argc, char *argv1[])
 {
   char *const argv[] = { "test-core-api",
     "-c",
@@ -361,26 +359,17 @@ check ()
     GNUNET_GETOPT_OPTION_END
   };
   ok = 1;
+  GNUNET_log_setup ("test-core-api",
+                    "WARNING",
+                    NULL);
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                       "test-core-api", "nohelp", options, &run, &ok);
   stop_arm (&p1);
   stop_arm (&p2);
-  return ok;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-core-api",
-                    "WARNING",
-                    NULL);
-  ret = check ();
   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
 
-  return ret;
+  return ok;
 }
 
 /* end of test_core_api.c */