convert fs publish to MQ
[oweals/gnunet.git] / src / core / test_core_api.c
index b1c6c8212884f4f968cc3e87ff7a3c44a5ee5ffe..92ee038da3f81a9dc274b268bd6585b93a5518eb 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2015 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2010, 2015 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -50,8 +50,6 @@ static struct PeerContext p2;
 
 static struct GNUNET_SCHEDULER_Task *err_task;
 
-static struct GNUNET_SCHEDULER_Task *con_task;
-
 static int ok;
 
 #define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
@@ -101,24 +99,17 @@ terminate_peer (struct PeerContext *p)
 
 
 static void
-terminate_task (void *cls,
-                const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
 {
   GNUNET_assert (ok == 6);
   terminate_peer (&p1);
   terminate_peer (&p2);
-  if (NULL != con_task)
-  {
-    GNUNET_SCHEDULER_cancel (con_task);
-    con_task = NULL;
-  }
   ok = 0;
 }
 
 
 static void
-terminate_task_error (void *cls,
-                      const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task_error (void *cls)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "ENDING ANGRILY %u\n",
@@ -126,11 +117,6 @@ terminate_task_error (void *cls,
   GNUNET_break (0);
   terminate_peer (&p1);
   terminate_peer (&p2);
-  if (NULL != con_task)
-  {
-    GNUNET_SCHEDULER_cancel (con_task);
-    con_task = NULL;
-  }
   ok = 42;
 }
 
@@ -164,11 +150,6 @@ connect_notify (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Encrypted connection established to peer `%4s'\n",
               GNUNET_i2s (peer));
-  if (NULL != con_task)
-  {
-    GNUNET_SCHEDULER_cancel (con_task);
-    con_task = NULL;
-  }
   pc->connect_status = 1;
   if (pc == &p1)
   {
@@ -248,26 +229,6 @@ static struct GNUNET_CORE_MessageHandler handlers[] = {
 };
 
 
-static void
-connect_task (void *cls,
-              const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-  {
-    con_task = NULL;
-    return;
-  }
-  con_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                    &connect_task,
-                                    NULL);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Asking transport (1) to connect to peer `%4s'\n",
-              GNUNET_i2s (&p2.id));
-  GNUNET_TRANSPORT_try_connect (p1.th, &p2.id, NULL, NULL); /*FIXME TRY_CONNECT change */
-}
-
-
 static void
 init_notify (void *cls,
              const struct GNUNET_PeerIdentity *my_identity)
@@ -293,7 +254,9 @@ init_notify (void *cls,
     GNUNET_assert (ok == 3);
     OKPP;
     GNUNET_assert (cls == &p2);
-    con_task = GNUNET_SCHEDULER_add_now (&connect_task, NULL);
+    p1.ats_sh = GNUNET_ATS_connectivity_suggest (p1.ats,
+                                                 &p2.id,
+                                                 1);
   }
 }