tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / ats-tests / ats-testing.c
index 9f0519fa34ac4cca85f2d941fb180562dda5bdf2..d8b9e5ef564a9154853513cfb9f03273bcf9d8ff 100644 (file)
@@ -1,21 +1,21 @@
 /*
  This file is part of GNUnet.
- Copyright (C) 2010-2013, 2016 GNUnet e.V.
+ Copyright (C) 2010-2013, 2016, 2017 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
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
 
  GNUnet is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
Affero General Public License for more details.
 
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
  */
 /**
  * @file ats-tests/ats-testing.c
@@ -88,11 +88,6 @@ do_shutdown (void *cls)
 
     for (c_op = 0; c_op < p->num_partners; c_op++)
     {
-      if (NULL != p->partners[c_op].cth)
-      {
-        GNUNET_CORE_notify_transmit_ready_cancel (p->partners[c_op].cth);
-        p->partners[c_op].cth = NULL;
-      }
       if ( (NULL != p->core_connect_ops) &&
            (NULL != p->core_connect_ops[c_op].connect_op) )
       {
@@ -128,15 +123,6 @@ do_shutdown (void *cls)
       GNUNET_TESTBED_operation_done (p->peer_id_op);
       p->peer_id_op = NULL;
     }
-
-    for (c_op = 0; c_op < p->num_partners; c_op++)
-    {
-      if (NULL != p->partners[c_op].cth)
-      {
-        GNUNET_CORE_notify_transmit_ready_cancel (p->partners[c_op].cth);
-        p->partners[c_op].cth = NULL;
-      }
-    }
     if (NULL != p->ats_perf_op)
     {
       GNUNET_TESTBED_operation_done (p->ats_perf_op);
@@ -165,9 +151,8 @@ find_partner (struct BenchmarkPeer *me,
   for (c_m = 0; c_m < me->num_partners; c_m++)
   {
     /* Find a partner with other as destination */
-    if (0 == memcmp (peer,
-                    &me->partners[c_m].dest->id,
-                    sizeof (struct GNUNET_PeerIdentity)))
+    if (0 == GNUNET_memcmp (peer,
+                    &me->partners[c_m].dest->id))
     {
       return &me->partners[c_m];
     }
@@ -184,17 +169,15 @@ find_peer (const struct GNUNET_PeerIdentity * peer)
 
   for (c_p = 0; c_p < top->num_masters; c_p++)
   {
-    if (0 == memcmp (&top->mps[c_p].id,
-                    peer,
-                    sizeof(struct GNUNET_PeerIdentity)))
+    if (0 == GNUNET_memcmp (&top->mps[c_p].id,
+                    peer))
       return &top->mps[c_p];
   }
 
   for (c_p = 0; c_p < top->num_slaves; c_p++)
   {
-    if (0 == memcmp (&top->sps[c_p].id,
-                    peer,
-                    sizeof(struct GNUNET_PeerIdentity)))
+    if (0 == GNUNET_memcmp (&top->sps[c_p].id,
+                    peer))
       return &top->sps[c_p];
   }
   return NULL ;
@@ -314,11 +297,6 @@ comm_disconnect_cb (void *cls,
                "%s disconnected from %s while benchmarking\n",
                id,
                GNUNET_i2s (peer));
-    if (NULL != p->cth)
-    {
-      GNUNET_CORE_notify_transmit_ready_cancel (p->cth);
-      p->cth = NULL;
-    }
   }
   GNUNET_free(id);
 }
@@ -348,16 +326,16 @@ static void *
 transport_connect_adapter (void *cls,
                            const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  GNUNET_MQ_hd_fixed_size (ping,
-                           TEST_MESSAGE_TYPE_PING,
-                           struct TestMessage);
-  GNUNET_MQ_hd_fixed_size (pong,
-                           TEST_MESSAGE_TYPE_PONG,
-                           struct TestMessage);
   struct BenchmarkPeer *me = cls;
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_ping_handler (me),
-    make_pong_handler (me),
+    GNUNET_MQ_hd_fixed_size (ping,
+                             TEST_MESSAGE_TYPE_PING,
+                             struct TestMessage,
+                             me),
+    GNUNET_MQ_hd_fixed_size (pong,
+                             TEST_MESSAGE_TYPE_PONG,
+                             struct TestMessage,
+                             me),
     GNUNET_MQ_handler_end ()
   };
 
@@ -390,20 +368,20 @@ static void *
 core_connect_adapter (void *cls,
                      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  GNUNET_MQ_hd_fixed_size (ping,
-                           TEST_MESSAGE_TYPE_PING,
-                           struct TestMessage);
-  GNUNET_MQ_hd_fixed_size (pong,
-                           TEST_MESSAGE_TYPE_PONG,
-                           struct TestMessage);
   struct BenchmarkPeer *me = cls;
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_ping_handler (me),
-    make_pong_handler (me),
+    GNUNET_MQ_hd_fixed_size (ping,
+                             TEST_MESSAGE_TYPE_PING,
+                             struct TestMessage,
+                             me),
+    GNUNET_MQ_hd_fixed_size (pong,
+                             TEST_MESSAGE_TYPE_PONG,
+                             struct TestMessage,
+                             me),
     GNUNET_MQ_handler_end ()
   };
 
-  me->ch = GNUNET_CORE_connecT (cfg,
+  me->ch = GNUNET_CORE_connect (cfg,
                                me,
                                NULL,
                                &comm_connect_cb,
@@ -422,7 +400,7 @@ core_disconnect_adapter (void *cls,
 {
   struct BenchmarkPeer *me = cls;
 
-  GNUNET_CORE_disconnecT (me->ch);
+  GNUNET_CORE_disconnect (me->ch);
   me->ch = NULL;
 }
 
@@ -871,7 +849,7 @@ main_run (void *cls,
       /* Initialize properties */
       top->sps[c_s].partners[c_m].props.delay = GNUNET_TIME_UNIT_ZERO;
       top->sps[c_s].partners[c_m].props.distance = 0;
-      top->sps[c_s].partners[c_m].props.scope = GNUNET_ATS_NET_UNSPECIFIED;
+      top->sps[c_s].partners[c_m].props.scope = GNUNET_NT_UNSPECIFIED;
       top->sps[c_s].partners[c_m].props.utilization_in = 0;
       top->sps[c_s].partners[c_m].props.utilization_out = 0;
     }