gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 01/08: - add generic topology configuration by file - cmd simpl


From: gnunet
Subject: [gnunet] 01/08: - add generic topology configuration by file - cmd simple send using file configuration from file - added cmd to check the logs for backchannel encapsulation - added cmd which notifies the master loop of local loop being prepared to finish - added logging to helper.c - moved code from connecting peers cmd into global functions - added parameters given to the connecting peers cmd - added assertion when notifying the transport service about a new queue, if the communicator has no intial capa [...]
Date: Tue, 09 Nov 2021 19:45:12 +0100

This is an automated email from the git hooks/post-receive script.

t3sserakt pushed a commit to branch master
in repository gnunet.

commit d7fa0579995790840199ec86cb4d518f9d372fcd
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Thu Oct 7 13:07:30 2021 +0200

    - add generic topology configuration by file
    - cmd simple send using file configuration from file
    - added cmd to check the logs for backchannel encapsulation
    - added cmd which notifies the master loop of local loop being prepared to 
finish
    - added logging to helper.c
    - moved code from connecting peers cmd into global functions
    - added parameters given to the connecting peers cmd
    - added assertion when notifying the transport service about a new queue, 
if the communicator has no intial capacity
    - added optional valgrind cmd to test script
    - added flag für queues with unlimited length
    - added check for queues with higher priority
    - added attribute queue_capacity to struct Queue
    - bug fixing worker task for kce generation and transport notification 
about available queue in udp communicator
    - change value for unlimited queue length from 0 to UINT16_MAX in tcp 
communicator and service
    - added loop to stop the test system for the globally known peers in stop 
testsystem cmd
    - refactored endless growing array to handle further messages from the 
local loops, and added logic to handle the local test prepare msg
    - added utility methods in testing.c
    - added forwarding of all tests prepared msg in gnunet-cmds-helper.c
    - added cmd to end loop without shutdown
    - added without shutdown cmd to simple send testcase
    - added backchannel check, without shutdown and prepared cmd to udp 
backchannel testcase.
---
 src/include/gnunet_protocols.h                     |   6 +-
 src/include/gnunet_testing_ng_lib.h                |  97 +++-
 src/include/gnunet_testing_plugin.h                |   8 +
 src/testing/Makefile.am                            |   1 +
 src/testing/gnunet-cmds-helper.c                   |  10 +
 src/testing/test_testing_topology.c                |  44 ++
 src/testing/testing.c                              | 264 ++++++++-
 src/testing/testing_api_cmd_local_test_finished.c  |   2 +-
 ...hed.c => testing_api_cmd_local_test_prepared.c} |  67 ++-
 .../testing_api_cmd_netjail_start_testsystem_v2.c  | 181 ++++--
 src/testing/testing_api_cmd_netjail_start_v2.c     |   2 +-
 .../testing_api_cmd_netjail_stop_testsystem_v2.c   |  22 +-
 src/testing/testing_api_loop.c                     |  19 +-
 src/testing/testing_cmds.h                         |  17 +
 src/transport/Makefile.am                          |   2 +
 src/transport/gnunet-communicator-tcp.c            |  20 +-
 src/transport/gnunet-communicator-udp.c            | 101 ++--
 src/transport/gnunet-service-tng.c                 | 207 ++++++-
 .../test_transport_plugin_cmd_simple_send.c        |   7 +-
 .../test_transport_plugin_cmd_simple_send_v2.c     |   3 +-
 .../test_transport_plugin_cmd_udp_backchannel.c    |  37 +-
 src/transport/test_transport_udp_backchannel.sh    |   2 +
 src/transport/transport-testing-cmds.h             |  72 ++-
 src/transport/transport_api2_communication.c       |   9 +-
 .../transport_api_cmd_backchannel_check.c          | 628 +++++++++++++++++++++
 src/transport/transport_api_cmd_connecting_peers.c |  14 +-
 .../transport_api_cmd_connecting_peers_v3.c        | 251 +-------
 src/transport/transport_api_cmd_send_simple_v3.c   | 194 +++++++
 src/util/helper.c                                  |   4 +
 29 files changed, 1886 insertions(+), 405 deletions(-)

diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 41f2876e6..9e278eb92 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -3579,7 +3579,11 @@ extern "C" {
 
 #define GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED 1703
 
-#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED 1704
+#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED 1704
+
+#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED 1705
+
+#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED 1706
 
 
/*********************************************************************************/
 
diff --git a/src/include/gnunet_testing_ng_lib.h 
b/src/include/gnunet_testing_ng_lib.h
index 31665f8f7..6138f567b 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -79,17 +79,17 @@ enum GNUNET_TESTING_NODE_TYPE
   GNUNET_TESTING_GLOBAL_NODE
 };
 
-struct GNUNET_TESTING_ADDRESS_PREFIX
+struct GNUNET_TESTING_AddressPrefix
 {
   /**
    * Pointer to the previous prefix in the DLL.
    */
-  struct GNUNET_TESTING_ADDRESS_PREFIX *prev;
+  struct GNUNET_TESTING_AddressPrefix *prev;
 
   /**
    * Pointer to the next prefix in the DLL.
    */
-  struct GNUNET_TESTING_ADDRESS_PREFIX *next;
+  struct GNUNET_TESTING_AddressPrefix *next;
 
   /**
    * The address prefix.
@@ -138,12 +138,12 @@ struct GNUNET_TESTING_NodeConnection
   /**
    * Head of the DLL with the address prefixes for the protocolls this node is 
reachable.
    */
-  struct GNUNET_TESTING_ADDRESS_PREFIX *address_prefixes_head;
+  struct GNUNET_TESTING_AddressPrefix *address_prefixes_head;
 
   /**
    * Tail of the DLL with the address prefixes for the protocolls this node is 
reachable.
    */
-  struct GNUNET_TESTING_ADDRESS_PREFIX *address_prefixes_tail;
+  struct GNUNET_TESTING_AddressPrefix *address_prefixes_tail;
 };
 
 /**
@@ -379,6 +379,11 @@ struct GNUNET_TESTING_Command
    */
   bool asynchronous_finish;
 
+  /**
+   * Shall the scheduler shutdown, when end cmd is reach?
+   */
+  bool shutdown_on_end;
+
 };
 
 
@@ -449,6 +454,15 @@ struct GNUNET_TESTING_Command
 GNUNET_TESTING_cmd_end (void);
 
 
+/**
+ * Create command array terminator without shutdown.
+ *
+ * @return a end-command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_end_without_shutdown (void);
+
+
 /**
  * Turn asynchronous command into non blocking command by setting 
asynchronous_finish to true.
  *
@@ -660,6 +674,55 @@ struct GNUNET_TESTING_NetjailTopology *
 GNUNET_TESTING_get_topo_from_file (const char *filename);
 
 
+/**
+ * Get the connections to other nodes for a specific node.
+ *
+ * @param num The specific node we want the connections for.
+ * @param topology The topology we get the connections from.
+ * @return The connections of the node.
+ */
+struct GNUNET_TESTING_NodeConnection *
+GNUNET_TESTING_get_connections (unsigned int num, struct
+                                GNUNET_TESTING_NetjailTopology *topology);
+
+
+/**
+ * Get the address for a specific communicator from a connection.
+ *
+ * @param connection The connection we like to have the address from.
+ * @param prefix The communicator protocol prefix.
+ * @return The address of the communicator.
+ */
+char *
+GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
+                            char *prefix);
+
+
+/**
+ * Calculate the unique id identifying a node from a given connction.
+ *
+ * @param node_connection The connection we calculate the id from.
+ * @param topology The topology we get all needed information from.
+ * @return The unique id of the node from the connection.
+ */
+unsigned int
+GNUNET_TESTING_calculate_num (struct
+                              GNUNET_TESTING_NodeConnection *node_connection,
+                              struct GNUNET_TESTING_NetjailTopology *topology);
+
+
+/**
+ * Retrieve the public key from the test system with the unique node id.
+ *
+ * @param num The unique node id.
+ * @param tl_system The test system.
+ * @return The peer identity wrapping the public key.
+ */
+struct GNUNET_PeerIdentity *
+GNUNET_TESTING_get_pub_key (unsigned int num, struct
+                            GNUNET_TESTING_System *tl_system);
+
+
 /**
  * Obtain performance data from the interpreter.
  *
@@ -1183,12 +1246,36 @@ GNUNET_TESTING_cmd_block_until_external_trigger (const 
char *label,
                                                  unsigned int *
                                                  stop_blocking);
 
+
 struct GNUNET_TESTING_Command
 GNUNET_TESTING_cmd_send_peer_ready (const char *label,
                                     TESTING_CMD_HELPER_write_cb write_message);
 
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param write_message Callback to write messages to the master loop.
+ * @return command.
+ */
 struct GNUNET_TESTING_Command
 GNUNET_TESTING_cmd_local_test_finished (const char *label,
                                         TESTING_CMD_HELPER_write_cb
                                         write_message);
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param write_message Callback to write messages to the master loop.
+ * @param all_local_tests_prepared Flag which will be set from outside.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_local_test_prepared (const char *label,
+                                        TESTING_CMD_HELPER_write_cb
+                                        write_message,
+                                        unsigned int *
+                                        all_local_tests_prepared);
 #endif
diff --git a/src/include/gnunet_testing_plugin.h 
b/src/include/gnunet_testing_plugin.h
index 151827d4b..4a6a9368e 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -48,9 +48,15 @@ typedef void
                                         char *m,
                                         char *local_m);
 
+
 typedef void
 (*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) ();
 
+
+typedef void
+(*GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED) ();
+
+
 struct GNUNET_TESTING_PluginFunctions
 {
   /**
@@ -61,6 +67,8 @@ struct GNUNET_TESTING_PluginFunctions
   GNUNET_TESTING_PLUGIN_StartTestCase start_testcase;
 
   GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started;
+
+  GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED all_local_tests_prepared;
 };
 
 #if 0                           /* keep Emacsens' auto-indent happy */
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index efb22b279..07caeb44e 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -44,6 +44,7 @@ libgnunet_test_testing_plugin_testcmd_la_LDFLAGS = \
 
 libgnunettesting_la_SOURCES = \
   testing_api_cmd_local_test_finished.c \
+  testing_api_cmd_local_test_prepared.c \
   testing_api_cmd_send_peer_ready.c \
   testing_api_cmd_block_until_all_peers_started.c \
   testing_api_cmd_block_until_external_trigger.c \
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
index e50db0cf6..4aeccb115 100644
--- a/src/testing/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -418,9 +418,19 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader 
*message)
   else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs (
              message->type))
   {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "all peers started\n");
     plugin->api->all_peers_started ();
     return GNUNET_OK;
   }
+  else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED == ntohs (
+             message->type))
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "all local tests prepared\n");
+    plugin->api->all_local_tests_prepared ();
+    return GNUNET_OK;
+  }
   else
   {
     LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- 
exiting\n");
diff --git a/src/testing/test_testing_topology.c 
b/src/testing/test_testing_topology.c
new file mode 100644
index 000000000..cfc91e609
--- /dev/null
+++ b/src/testing/test_testing_topology.c
@@ -0,0 +1,44 @@
+/*
+     This file is part of GNUnet
+     Copyright (C) 2021 GNUnet e.V.
+
+     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
+     Affero General Public License for more details.
+
+     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 testbed/plugin_testcmd.c
+ * @brief a plugin to provide the API for running test cases.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+
+#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
+
+int
+main (int argc,
+      char *const *argv)
+{
+  GNUNET_log_setup ("test-topology",
+                    "DEBUG",
+                    NULL);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Test\n");
+  GNUNET_TESTING_get_topo_from_file ("topo.conf");
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Test2\n");
+}
diff --git a/src/testing/testing.c b/src/testing/testing.c
index a11d404a5..d3acd4689 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -37,6 +37,15 @@
 
 #define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
 
+#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u:60002"
+
+#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u:60002"
+
+#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u:60002"
+
+#define PREFIX_TCP "tcp"
+
+#define PREFIX_UDP "udp"
 
 /**
  * Lowest port used for GNUnet testing.  Should be high enough to not
@@ -1900,7 +1909,7 @@ get_connect_value (char *line, struct 
GNUNET_TESTING_NetjailNode *node)
   unsigned int namespace_n;
   char *rest = NULL;
   char *rest2 = NULL;
-  struct GNUNET_TESTING_ADDRESS_PREFIX *prefix;
+  struct GNUNET_TESTING_AddressPrefix *prefix;
 
   node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
   node_connection->node = node;
@@ -1936,7 +1945,7 @@ get_connect_value (char *line, struct 
GNUNET_TESTING_NetjailNode *node)
   }
   while (NULL != (token = strtok_r (NULL, ":", &rest)))
   {
-    prefix = GNUNET_new (struct GNUNET_TESTING_ADDRESS_PREFIX);
+    prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
     token2 = strtok_r (token, "}", &rest2);
     if (NULL != token2)
     {
@@ -1958,13 +1967,12 @@ get_connect_value (char *line, struct 
GNUNET_TESTING_NetjailNode *node)
     GNUNET_CONTAINER_DLL_insert (node_connection->address_prefixes_head,
                                  node_connection->address_prefixes_tail,
                                  prefix);
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         "address_prefix %s\n",
+         prefix->address_prefix);
   }
 
   GNUNET_free (copy);
-  LOG (GNUNET_ERROR_TYPE_ERROR,
-       "address_prefix %s\n",
-       prefix->address_prefix);
-
   return node_connection;
 }
 
@@ -2006,6 +2014,250 @@ node_connections (char *line, struct 
GNUNET_TESTING_NetjailNode *node)
 }
 
 
+static int
+log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
+{
+  struct GNUNET_TESTING_NetjailNode *node = value;
+  struct GNUNET_TESTING_NodeConnection *pos_connection;
+  struct GNUNET_TESTING_AddressPrefix *pos_prefix;
+
+  LOG (GNUNET_ERROR_TYPE_ERROR,
+       "plugin: %s space: %u node: %u global: %u\n",
+       node->plugin,
+       node->namespace_n,
+       node->node_n,
+       node->is_global);
+
+  for (pos_connection = node->node_connections_head; NULL != pos_connection;
+       pos_connection = pos_connection->next)
+  {
+
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         "namespace_n: %u node_n: %u node_type: %u\n",
+         pos_connection->namespace_n,
+         pos_connection->node_n,
+         pos_connection->node_type);
+
+    for (pos_prefix = pos_connection->address_prefixes_head; NULL != 
pos_prefix;
+         pos_prefix =
+           pos_prefix->next)
+    {
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           "prefix: %s\n",
+           pos_prefix->address_prefix);
+    }
+  }
+  return GNUNET_YES;
+}
+
+
+static int
+log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
+{
+  struct GNUNET_TESTING_NetjailNamespace *namespace = value;
+  struct GNUNET_TESTING_NetjailRouter *router = namespace->router;
+
+  LOG (GNUNET_ERROR_TYPE_ERROR,
+       "router_tcp: %u router_udp: %u spaces: %u\n",
+       router->tcp_port,
+       router->udp_port,
+       namespace->namespace_n);
+  GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, &log_nodes, NULL);
+  return GNUNET_YES;
+}
+
+
+static int
+log_topo (struct GNUNET_TESTING_NetjailTopology *topology)
+{
+  LOG (GNUNET_ERROR_TYPE_ERROR,
+       "plugin: %s spaces: %u nodes: %u known: %u\n",
+       topology->plugin,
+       topology->namespaces_n,
+       topology->nodes_m,
+       topology->nodes_x);
+
+  GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
+                                          log_namespaces, NULL);
+  GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, &log_nodes,
+                                          NULL);
+  return GNUNET_YES;
+}
+
+
+/**
+ * Get the connections to other nodes for a specific node.
+ *
+ * @param num The specific node we want the connections for.
+ * @param topology The topology we get the connections from.
+ * @return The connections of the node.
+ */
+struct GNUNET_TESTING_NodeConnection *
+GNUNET_TESTING_get_connections (unsigned int num, struct
+                                GNUNET_TESTING_NetjailTopology *topology)
+{
+  struct GNUNET_TESTING_NetjailNode *node;
+  struct GNUNET_ShortHashCode *hkey;
+  struct GNUNET_HashCode hc;
+  struct GNUNET_TESTING_NetjailNamespace *namespace;
+  unsigned int namespace_n, node_m;
+
+  log_topo (topology);
+
+  hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+  if (topology->nodes_x >= num)
+  {
+
+    GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
+    memcpy (hkey,
+            &hc,
+            sizeof (*hkey));
+    node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
+                                               hkey);
+  }
+  else
+  {
+    namespace_n = (unsigned int) floor ((num - topology->nodes_x)
+                                        / topology->nodes_m);
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         "num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
+         num,
+         topology->nodes_x,
+         topology->nodes_m,
+         namespace_n);
+    hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+    GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
+    memcpy (hkey,
+            &hc,
+            sizeof (*hkey));
+    namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
+                                                    hkey);
+    node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
+    hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+    GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
+    memcpy (hkey,
+            &hc,
+            sizeof (*hkey));
+    node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
+                                               hkey);
+  }
+
+
+  return node->node_connections_head;
+}
+
+
+/**
+ * Retrieve the public key from the test system with the unique node id.
+ *
+ * @param num The unique node id.
+ * @param tl_system The test system.
+ * @return The peer identity wrapping the public key.
+ */
+struct GNUNET_PeerIdentity *
+GNUNET_TESTING_get_pub_key (unsigned int num, struct
+                            GNUNET_TESTING_System *tl_system)
+{
+  struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
+  struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct
+                                                             
GNUNET_CRYPTO_EddsaPublicKey);
+  struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct
+                                                               
GNUNET_CRYPTO_EddsaPrivateKey);
+
+  priv_key = GNUNET_TESTING_hostkey_get (tl_system,
+                                         num,
+                                         peer);
+
+  GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
+                                      pub_key);
+  peer->public_key = *pub_key;
+  return peer;
+}
+
+
+/**
+ * Calculate the unique id identifying a node from a given connction.
+ *
+ * @param node_connection The connection we calculate the id from.
+ * @param topology The topology we get all needed information from.
+ * @return The unique id of the node from the connection.
+ */
+unsigned int
+GNUNET_TESTING_calculate_num (struct
+                              GNUNET_TESTING_NodeConnection *node_connection,
+                              struct GNUNET_TESTING_NetjailTopology *topology)
+{
+  unsigned int n, m, num;
+
+  n = node_connection->namespace_n;
+  m = node_connection->node_n;
+
+  if (0 == n)
+    num = m;
+  else
+    num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
+
+  return num;
+}
+
+
+/**
+ * Get the address for a specific communicator from a connection.
+ *
+ * @param connection The connection we like to have the address from.
+ * @param prefix The communicator protocol prefix.
+ * @return The address of the communicator.
+ */
+char *
+GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
+                            char *prefix)
+{
+  struct GNUNET_TESTING_NetjailNode *node;
+  char *addr;
+  char *template;
+
+  LOG (GNUNET_ERROR_TYPE_ERROR,
+       "node_n: %u\n",
+       connection->node_n);
+
+  node = connection->node;
+  if (connection->namespace_n == node->namespace_n)
+  {
+    template = CONNECT_ADDRESS_TEMPLATE;
+  }
+  else if (0 == connection->namespace_n)
+  {
+    template = KNOWN_CONNECT_ADDRESS_TEMPLATE;
+  }
+  else
+  {
+    template = ROUTER_CONNECT_ADDRESS_TEMPLATE;
+  }
+
+  if (0 == strcmp (PREFIX_TCP, prefix))
+  {
+
+    GNUNET_asprintf (&addr,
+                     template,
+                     prefix,
+                     connection->node_n);
+  }
+  else if (0 == strcmp (PREFIX_UDP, prefix))
+  {
+    GNUNET_asprintf (&addr,
+                     template,
+                     prefix,
+                     connection->node_n);
+  }
+  else
+  {
+    GNUNET_break (0);
+  }
+
+  return addr;
+}
+
+
 /**
  * Getting the topology from file.
  *
diff --git a/src/testing/testing_api_cmd_local_test_finished.c 
b/src/testing/testing_api_cmd_local_test_finished.c
index 383de4c10..b50e471e9 100644
--- a/src/testing/testing_api_cmd_local_test_finished.c
+++ b/src/testing/testing_api_cmd_local_test_finished.c
@@ -115,7 +115,7 @@ local_test_finished_finish (void *cls,
                             GNUNET_SCHEDULER_TaskCallback cont,
                             void *cont_cls)
 {
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
+  LOG (GNUNET_ERROR_TYPE_ERROR,
        "Stopping local loop\n");
   return GNUNET_YES;
 }
diff --git a/src/testing/testing_api_cmd_local_test_finished.c 
b/src/testing/testing_api_cmd_local_test_prepared.c
similarity index 63%
copy from src/testing/testing_api_cmd_local_test_finished.c
copy to src/testing/testing_api_cmd_local_test_prepared.c
index 383de4c10..4e915c7c0 100644
--- a/src/testing/testing_api_cmd_local_test_finished.c
+++ b/src/testing/testing_api_cmd_local_test_prepared.c
@@ -19,7 +19,7 @@
  */
 
 /**
- * @file testing_api_cmd_block_until_all_peers_started.c
+ * @file testing_api_cmd_local_test_prepared.c
  * @brief cmd to block the interpreter loop until all peers started.
  * @author t3sserakt
  */
@@ -38,7 +38,7 @@
  * Struct to hold information for callbacks.
  *
  */
-struct LocalFinishedState
+struct LocalPreparedState
 {
   /**
    * Callback to write messages to the master loop.
@@ -50,7 +50,12 @@ struct LocalFinishedState
    * The message send back to the master loop.
    *
    */
-  struct GNUNET_CMDS_LOCAL_FINISHED *reply;
+  struct GNUNET_CMDS_LOCAL_TEST_PREPARED *reply;
+
+  /**
+   * Flag indicating if all local tests finished.
+   */
+  unsigned int *all_local_tests_prepared;
 };
 
 
@@ -59,7 +64,7 @@ struct LocalFinishedState
  *
  */
 static int
-local_test_finished_traits (void *cls,
+local_test_prepared_traits (void *cls,
                             const void **ret,
                             const char *trait,
                             unsigned int index)
@@ -73,10 +78,10 @@ local_test_finished_traits (void *cls,
  *
  */
 static void
-local_test_finished_cleanup (void *cls,
+local_test_prepared_cleanup (void *cls,
                              const struct GNUNET_TESTING_Command *cmd)
 {
-  struct LocalFinishedState *lfs = cls;
+  struct LocalPreparedState *lfs = cls;
 
   GNUNET_free (lfs->reply);
   GNUNET_free (lfs);
@@ -84,22 +89,23 @@ local_test_finished_cleanup (void *cls,
 
 
 /**
- * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED 
message to the master loop.
+ * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED 
message to the master loop.
  *
  */
 static void
-local_test_finished_run (void *cls,
+local_test_prepared_run (void *cls,
                          const struct GNUNET_TESTING_Command *cmd,
                          struct GNUNET_TESTING_Interpreter *is)
 {
-  struct LocalFinishedState *lfs = cls;
+  struct LocalPreparedState *lfs = cls;
 
-  struct GNUNET_CMDS_LOCAL_FINISHED *reply;
+  struct GNUNET_CMDS_LOCAL_TEST_PREPARED *reply;
   size_t msg_length;
 
-  msg_length = sizeof(struct GNUNET_CMDS_LOCAL_FINISHED);
-  reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_FINISHED);
-  reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
+  msg_length = sizeof(struct GNUNET_CMDS_LOCAL_TEST_PREPARED);
+  reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_TEST_PREPARED);
+  reply->header.type = htons (
+    GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED);
   reply->header.size = htons ((uint16_t) msg_length);
   lfs->reply = reply;
   lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
@@ -111,13 +117,20 @@ local_test_finished_run (void *cls,
  *
  */
 static int
-local_test_finished_finish (void *cls,
+local_test_prepared_finish (void *cls,
                             GNUNET_SCHEDULER_TaskCallback cont,
                             void *cont_cls)
 {
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Stopping local loop\n");
-  return GNUNET_YES;
+  struct LocalPreparedState *lfs = cls;
+  unsigned int *ret = lfs->all_local_tests_prepared;
+
+  if (GNUNET_YES == *ret)
+  {
+    cont (cont_cls);
+  }
+
+  return *ret;
+
 }
 
 
@@ -126,25 +139,29 @@ local_test_finished_finish (void *cls,
  *
  * @param label name for command.
  * @param write_message Callback to write messages to the master loop.
+ * @param all_local_tests_prepared Flag which will be set from outside.
  * @return command.
  */
 struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_local_test_finished (const char *label,
+GNUNET_TESTING_cmd_local_test_prepared (const char *label,
                                         TESTING_CMD_HELPER_write_cb
-                                        write_message)
+                                        write_message,
+                                        unsigned int *
+                                        all_local_tests_prepared)
 {
-  struct LocalFinishedState *lfs;
+  struct LocalPreparedState *lfs;
 
-  lfs = GNUNET_new (struct LocalFinishedState);
+  lfs = GNUNET_new (struct LocalPreparedState);
   lfs->write_message = write_message;
+  lfs->all_local_tests_prepared = all_local_tests_prepared;
 
   struct GNUNET_TESTING_Command cmd = {
     .cls = lfs,
     .label = label,
-    .run = &local_test_finished_run,
-    .finish = &local_test_finished_finish,
-    .cleanup = &local_test_finished_cleanup,
-    .traits = &local_test_finished_traits
+    .run = &local_test_prepared_run,
+    .finish = &local_test_prepared_finish,
+    .cleanup = &local_test_prepared_cleanup,
+    .traits = &local_test_prepared_traits
   };
 
   return cmd;
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c 
b/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c
index ccb3f5ae8..5e27a7a82 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c
@@ -29,6 +29,11 @@
 
 #define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec_v2.sh"
 
+/**
+ * Generic logging shortcut
+ */
+#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
+
 /**
  * Struct to store messages send/received by the helper into a DLL
  *
@@ -116,13 +121,13 @@ struct NetJailState
   /**
    * The send handle for the helper
    */
-  struct GNUNET_HELPER_SendHandle **shandle;
+  // struct GNUNET_HELPER_SendHandle **shandle;
 
   /**
    * Size of the array NetJailState#shandle.
    *
    */
-  unsigned int n_shandle;
+  // unsigned int n_shandle;
 
   /**
    * The messages send to the helper.
@@ -151,7 +156,13 @@ struct NetJailState
    * Number of local tests finished.
    *
    */
-  unsigned int number_of_local_test_finished;
+  unsigned int number_of_local_tests_finished;
+
+  /**
+   * Number of local tests prepared to finish.
+   *
+   */
+  unsigned int number_of_local_tests_prepared;
 
   /**
    * Name of the test case plugin the helper will load.
@@ -188,6 +199,17 @@ struct TestingSystemCount
    */
   struct TestingSystemCount *prev;
 
+  /**
+   * The send handle for the helper
+   */
+  struct GNUNET_HELPER_SendHandle *shandle;// **shandle;
+
+  /**
+   * Size of the array NetJailState#shandle.
+   *
+   */
+  // unsigned int n_shandle;
+
   /**
    * The number of the test environment.
    *
@@ -277,10 +299,9 @@ netjail_exec_traits (void *cls,
  * @return #GNUNET_OK on success.
  */
 int
-GNUNET_TESTING_get_trait_helper_handles_v2 (const struct
-                                            GNUNET_TESTING_Command *cmd,
-                                            struct GNUNET_HELPER_Handle ***
-                                            helper)
+GNUNET_TESTING_get_trait_helper_handles_v2 (
+  const struct GNUNET_TESTING_Command *cmd,
+  struct GNUNET_HELPER_Handle ***helper)
 {
   return cmd->traits (cmd->cls,
                       (const void **) helper,
@@ -293,18 +314,19 @@ GNUNET_TESTING_get_trait_helper_handles_v2 (const struct
  * Continuation function from GNUNET_HELPER_send()
  *
  * @param cls closure
- * @param result GNUNET_OK on success,
- *               GNUNET_NO if helper process died
- *               GNUNET_SYSERR during GNUNET_HELPER_stop
+ * @param result #GNUNET_OK on success,
+ *               #GNUNET_NO if helper process died
+ *               #GNUNET_SYSERR during GNUNET_HELPER_stop
  */
 static void
-clear_msg (void *cls, int result)
+clear_msg (void *cls,
+           int result)
 {
   struct TestingSystemCount *tbc = cls;
   struct NetJailState *ns = tbc->ns;
 
-  GNUNET_assert (NULL != ns->shandle[tbc->count - 1]);
-  ns->shandle[tbc->count - 1] = NULL;
+  GNUNET_assert (NULL != tbc->shandle);// [tbc->count - 1]);
+  tbc->shandle = NULL;// [tbc->count - 1] = NULL;
   GNUNET_free (ns->msg[tbc->count - 1]);
   ns->msg[tbc->count - 1] = NULL;
 }
@@ -323,10 +345,11 @@ clear_msg (void *cls, int result)
  * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
  */
 static int
-helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
+helper_mst (void *cls,
+            const struct GNUNET_MessageHeader *message)
 {
-  struct TestingSystemCount *tbc = cls;
-  struct NetJailState *ns = tbc->ns;
+  // struct TestingSystemCount *tbc = cls;
+  struct NetJailState *ns = cls;// tbc->ns;
   struct HelperMessage *hp_msg;
 
   if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type))
@@ -338,10 +361,18 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader 
*message)
   {
     ns->number_of_peers_started++;
   }
+  else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED == ntohs (
+             message->type))
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "received prepare msg %u\n",
+         ns->number_of_local_tests_prepared);
+    ns->number_of_local_tests_prepared++;
+  }
   else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs (
              message->type))
   {
-    ns->number_of_local_test_finished++;
+    ns->number_of_local_tests_finished++;
   }
   else
   {
@@ -364,8 +395,10 @@ static void
 exp_cb (void *cls)
 {
   struct NetJailState *ns = cls;
+  unsigned int *rv = ns->rv;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n");
-  *ns->rv = 1;
+  *rv = 1;
 }
 
 
@@ -420,6 +453,7 @@ start_helper (struct NetJailState *ns, struct
   struct GNUNET_TESTING_NetjailTopology *topology = ns->topology;
   struct GNUNET_TESTING_NetjailNode *node;
   struct GNUNET_TESTING_NetjailNamespace *namespace;
+  unsigned int *rv = ns->rv;
 
 
   if (0 == n)
@@ -460,7 +494,8 @@ start_helper (struct NetJailState *ns, struct
   else
     tbc->count = (n - 1) * ns->local_m + m + ns->known;
 
-  GNUNET_CONTAINER_DLL_insert (ns->tbcs_head, ns->tbcs_tail,
+  GNUNET_CONTAINER_DLL_insert (ns->tbcs_head,
+                               ns->tbcs_tail,
                                tbc);
 
 
@@ -469,14 +504,14 @@ start_helper (struct NetJailState *ns, struct
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "No SUID for %s!\n",
                 NETJAIL_EXEC_SCRIPT);
-    *ns->rv = 1;
+    *rv = 1;
   }
   else if (GNUNET_NO == helper_check)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "%s not found!\n",
                 NETJAIL_EXEC_SCRIPT);
-    *ns->rv = 1;
+    *rv = 1;
   }
 
   GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start (
@@ -485,7 +520,7 @@ start_helper (struct NetJailState *ns, struct
                          script_argv,
                          &helper_mst,
                          &exp_cb,
-                         tbc));
+                         ns));
 
   helper = ns->helper[tbc->count - 1];
 
@@ -542,19 +577,20 @@ start_helper (struct NetJailState *ns, struct
 
   GNUNET_array_append (ns->msg, ns->n_msg, &msg->header);
 
-  GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send (
-                         helper,
-                         &msg->header,
-                         GNUNET_NO,
-                         &clear_msg,
-                         tbc));
+  // GNUNET_array_append (tbc->shandle, tbc->n_shandle,
+  tbc->shandle = GNUNET_HELPER_send (
+    helper,
+    &msg->header,
+    GNUNET_NO,
+    &clear_msg,
+    tbc);                     // );
 
-  if (NULL == ns->shandle[tbc->count - 1])
+  if (NULL == tbc->shandle)// [tbc->count - 1])
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Send handle is NULL!\n");
     GNUNET_free (msg);
-    *ns->rv = 1;
+    *rv = 1;
   }
 }
 
@@ -595,39 +631,76 @@ netjail_exec_run (void *cls,
 
 
 static void
-send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState 
*ns)
+send_message_to_locals (
+  unsigned int i,
+  unsigned int j,
+  struct NetJailState *ns,
+  struct GNUNET_MessageHeader *header
+  )
 {
-  unsigned int total_number = ns->local_m * ns->global_n + ns->known;
-  struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
-  size_t msg_length;
+  // unsigned int total_number = ns->local_m * ns->global_n + ns->known;
   struct GNUNET_HELPER_Handle *helper;
   struct TestingSystemCount *tbc;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "send message to locals\n");
   tbc = GNUNET_new (struct TestingSystemCount);
   tbc->ns = ns;
   // TODO This needs to be more generic. As we send more messages back and 
forth, we can not grow the arrays again and again, because this is to error 
prone.
   if (0 == i)
-    tbc->count = j + total_number;
+    tbc->count = j; // + total_number;
   else
-    tbc->count = (i - 1) * ns->local_m + j + total_number + ns->known;
+    tbc->count = (i - 1) * ns->local_m + j + ns->known; // + total_number ;
 
-  helper = ns->helper[tbc->count - 1 - total_number];
-  msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED);
-  reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED);
-  reply->header.type = htons (
-    GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
-  reply->header.size = htons ((uint16_t) msg_length);
+  helper = ns->helper[tbc->count - 1];// - total_number];
 
-  GNUNET_array_append (ns->msg, ns->n_msg, &reply->header);
+  GNUNET_array_append (ns->msg, ns->n_msg, header);
 
   struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
     helper,
-    &reply->header,
+    header,
     GNUNET_NO,
     &clear_msg,
     tbc);
 
-  GNUNET_array_append (ns->shandle, ns->n_shandle, sh);
+  tbc->shandle = sh;
+  // GNUNET_array_append (tbc->shandle, tbc->n_shandle, sh);
+}
+
+
+static void
+send_all_local_tests_prepared (unsigned int i, unsigned int j, struct
+                               NetJailState *ns)
+{
+  struct GNUNET_CMDS_ALL_LOCAL_TESTS_PREPARED *reply;
+  size_t msg_length;
+
+
+  msg_length = sizeof(struct GNUNET_CMDS_ALL_LOCAL_TESTS_PREPARED);
+  reply = GNUNET_new (struct GNUNET_CMDS_ALL_LOCAL_TESTS_PREPARED);
+  reply->header.type = htons (
+    GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED);
+  reply->header.size = htons ((uint16_t) msg_length);
+
+  send_message_to_locals (i, j, ns, &reply->header);
+}
+
+
+static void
+send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState 
*ns)
+{
+
+  struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
+  size_t msg_length;
+
+
+  msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED);
+  reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED);
+  reply->header.type = htons (
+    GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
+  reply->header.size = htons ((uint16_t) msg_length);
+
+  send_message_to_locals (i, j, ns, &reply->header);
 }
 
 
@@ -650,12 +723,28 @@ netjail_start_finish (void *cls,
   unsigned int total_number = ns->local_m * ns->global_n + ns->known;
 
 
-  if (ns->number_of_local_test_finished == total_number)
+  if (ns->number_of_local_tests_finished == total_number)
   {
     ret = GNUNET_YES;
     cont (cont_cls);
   }
 
+  if (ns->number_of_local_tests_prepared == total_number)
+  {
+    for (int i = 1; i <= ns->known; i++)
+    {
+      send_all_local_tests_prepared (0,i, ns);
+    }
+
+    for (int i = 1; i <= ns->global_n; i++)
+    {
+      for (int j = 1; j <= ns->local_m; j++)
+      {
+        send_all_local_tests_prepared (i,j, ns);
+      }
+    }
+  }
+
   if (ns->number_of_testsystems_started == total_number)
   {
     ns->number_of_testsystems_started = 0;
diff --git a/src/testing/testing_api_cmd_netjail_start_v2.c 
b/src/testing/testing_api_cmd_netjail_start_v2.c
index 36fbb0e10..7d802db6a 100644
--- a/src/testing/testing_api_cmd_netjail_start_v2.c
+++ b/src/testing/testing_api_cmd_netjail_start_v2.c
@@ -75,7 +75,7 @@ netjail_start_cleanup (void *cls,
   {
     GNUNET_assert (0 ==
                    GNUNET_OS_process_kill (ns->start_proc,
-                                           SIGKILL));
+                                           SIGTERM));
     GNUNET_assert (GNUNET_OK ==
                    GNUNET_OS_process_wait (ns->start_proc));
     GNUNET_OS_process_destroy (ns->start_proc);
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c 
b/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c
index 8eccc5764..6ce106eaa 100644
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c
@@ -45,6 +45,12 @@ struct StopHelperState
   unsigned int local_m;
 
   unsigned int global_n;
+
+  /**
+   * Number of global known nodes.
+   *
+   */
+  unsigned int known;
 };
 
 
@@ -97,11 +103,24 @@ stop_testing_system_run (void *cls,
   GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd,
                                            &helper);
 
+  for (int i = 1; i <= shs->known; i++)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "i: %u\n",
+                i);
+    GNUNET_HELPER_stop (helper[i - 1],
+                        GNUNET_YES);
+  }
+
   for (int i = 1; i <= shs->global_n; i++)
   {
     for (int j = 1; j <= shs->local_m; j++)
     {
-      GNUNET_HELPER_stop (helper[(i - 1) * shs->local_m + j - 1],
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "i: %u j: %u\n",
+                  i,
+                  j);
+      GNUNET_HELPER_stop (helper[(i - 1) * shs->local_m + j + shs->known - 1],
                           GNUNET_YES);
     }
   }
@@ -130,6 +149,7 @@ GNUNET_TESTING_cmd_stop_testing_system_v2 (const char 
*label,
   shs->helper_start_label = helper_start_label;
   shs->local_m = topology->nodes_m;
   shs->global_n = topology->namespaces_n;
+  shs->known = topology->nodes_x;
 
   struct GNUNET_TESTING_Command cmd = {
     .cls = shs,
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 0c24c0e26..ab095aafa 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -408,6 +408,22 @@ GNUNET_TESTING_cmd_end (void)
 {
   static struct GNUNET_TESTING_Command cmd;
   cmd.label = NULL;
+  cmd.shutdown_on_end = GNUNET_YES;
+
+  return cmd;
+}
+
+/**
+ * Create command array terminator without shutdown.
+ *
+ * @return a end-command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_end_without_shutdown (void)
+{
+  static struct GNUNET_TESTING_Command cmd;
+  cmd.label = NULL;
+  cmd.shutdown_on_end = GNUNET_NO;
 
   return cmd;
 }
@@ -447,7 +463,8 @@ interpreter_run (void *cls)
                 "Running command END %p\n",
                 is);
     is->result = GNUNET_OK;
-    GNUNET_SCHEDULER_shutdown ();
+    if (GNUNET_YES == cmd->shutdown_on_end)
+      GNUNET_SCHEDULER_shutdown ();
     return;
   }
   else if (NULL != cmd)
diff --git a/src/testing/testing_cmds.h b/src/testing/testing_cmds.h
index 7a5860aea..005402a73 100644
--- a/src/testing/testing_cmds.h
+++ b/src/testing/testing_cmds.h
@@ -85,6 +85,23 @@ struct GNUNET_CMDS_LOCAL_FINISHED
   struct GNUNET_MessageHeader header;
 };
 
+struct GNUNET_CMDS_LOCAL_TEST_PREPARED
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED
+   */
+  struct GNUNET_MessageHeader header;
+};
+
+struct GNUNET_CMDS_ALL_LOCAL_TESTS_PREPARED
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED
+   */
+  struct GNUNET_MessageHeader header;
+};
+
 GNUNET_NETWORK_STRUCT_END
+
 #endif
 /* end of testing_cmds.h */
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 32075ee16..73544a8d5 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -163,12 +163,14 @@ libgnunettransporttesting2_la_SOURCES = \
   transport_api_cmd_connecting_peers.c \
   transport_api_cmd_connecting_peers_v2.c \
   transport_api_cmd_connecting_peers_v3.c \
+  transport_api_cmd_backchannel_check.c \
   transport_api_cmd_start_peer.c \
   transport_api_cmd_start_peer_v2.c \
   transport_api_cmd_start_peer_v3.c \
   transport_api_cmd_stop_peer.c \
   transport_api_cmd_send_simple.c \
   transport_api_cmd_send_simple_v2.c \
+  transport_api_cmd_send_simple_v3.c \
   transport-testing2.c transport-testing2.h \
   transport-testing-cmds.h \
   transport-testing-filenames2.c \
diff --git a/src/transport/gnunet-communicator-tcp.c 
b/src/transport/gnunet-communicator-tcp.c
index d8bf7c1a8..025326de7 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -1119,6 +1119,10 @@ pass_plaintext_to_core (struct Queue *queue,
   const struct GNUNET_MessageHeader *hdr = plaintext;
   int ret;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "pass message from %s to core\n",
+              GNUNET_i2s (&queue->target));
+
   if (ntohs (hdr->size) != plaintext_len)
   {
     /* NOTE: If we ever allow multiple CORE messages in one
@@ -1132,6 +1136,8 @@ pass_plaintext_to_core (struct Queue *queue,
                                                ADDRESS_VALIDITY_PERIOD,
                                                &core_read_finished_cb,
                                                queue);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "passed to core\n");
   if (GNUNET_OK == ret)
     queue->backpressure++;
   GNUNET_break (GNUNET_NO != ret);  /* backpressure not working!? */
@@ -1795,7 +1801,7 @@ try_handle_plaintext (struct Queue *queue)
     queue->qh = GNUNET_TRANSPORT_communicator_mq_add (ch,
                                                       &queue->target,
                                                       foreign_addr,
-                                                      UINT32_MAX, /* no MTU */
+                                                      UINT16_MAX, /* no MTU */
                                                       
GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED,
                                                       0, /* Priority */
                                                       queue->nt,
@@ -2444,7 +2450,7 @@ boot_queue (struct Queue *queue)
  * Generate and transmit our ephemeral key and the signature for
  * the initial KX with the other peer.  Must be called first, before
  * any other bytes are ever written to the output buffer.  Note that
- * our cipher must already be initialized when calling this function.
+ * our cipher must already be initialized when calling thi function.
  * Helper function for #start_initial_kx_out().
  *
  * @param queue queue to do KX for
@@ -2725,6 +2731,9 @@ proto_read_kx (void *cls)
   queue->listen_sock = pq->listen_sock;
   queue->sock = pq->sock;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "created queue with target %s\n",
+              GNUNET_i2s (&queue->target));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "start kx proto\n");
@@ -2984,6 +2993,9 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity 
*peer, const char *address)
   queue->sock = sock;
   queue->cs = GNUNET_TRANSPORT_CS_OUTBOUND;
   boot_queue (queue);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "booted queue with target %s\n",
+              GNUNET_i2s (&queue->target));
   // queue->mq_awaits_continue = GNUNET_YES;
   queue->read_task =
     GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
@@ -3646,6 +3658,10 @@ main (int argc, char *const *argv)
   };
   int ret;
 
+  GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG,
+                           "transport",
+                           "Starting tcp communicator\n");
+
   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
     return 2;
 
diff --git a/src/transport/gnunet-communicator-udp.c 
b/src/transport/gnunet-communicator-udp.c
index ef7b1d6c0..659fd7d26 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1494,7 +1494,27 @@ add_acks (struct SharedSecret *ss, int acks_to_add)
 
   GNUNET_assert (NULL != ss);
   GNUNET_assert (NULL != receiver);
-  GNUNET_assert (NULL != receiver->d_qh);
+
+  if (NULL == receiver->d_qh)
+  {
+    receiver->d_qh =
+      GNUNET_TRANSPORT_communicator_mq_add (ch,
+                                            &receiver->target,
+                                            receiver->foreign_addr,
+                                            receiver->d_mtu,
+                                            acks_to_add,
+                                            1, /* Priority */
+                                            receiver->nt,
+                                            GNUNET_TRANSPORT_CS_OUTBOUND,
+                                            receiver->d_mq);
+  }
+  else
+  {
+    GNUNET_TRANSPORT_communicator_mq_update (ch,
+                                             receiver->d_qh,
+                                             acks_to_add,
+                                             1);
+  }
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Tell transport we have %u more acks!\n",
@@ -1502,10 +1522,7 @@ add_acks (struct SharedSecret *ss, int acks_to_add)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "%u kce for rekeying.\n",
               receiver->number_rekeying_kce);
-  GNUNET_TRANSPORT_communicator_mq_update (ch,
-                                           receiver->d_qh,
-                                           acks_to_add,
-                                           1);
+
   // Until here for alternativ 1
 
   /* move ss to head to avoid discarding it anytime soon! */
@@ -1744,7 +1761,7 @@ kce_generate_cb (void *cls)
   if (((GNUNET_NO == ss->sender->rekeying) && (ss->sender->acks_available <
                                                KCN_TARGET) ) ||
       ((ss->sender->ss_rekey == ss) && (GNUNET_YES == ss->sender->rekeying) &&
-       (ss->sender->acks_available < 128)))
+       (ss->sender->acks_available < KCN_TARGET)))
   {
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1754,20 +1771,24 @@ kce_generate_cb (void *cls)
     for (int i = 0; i < GENERATE_AT_ONCE; i++)
       kce_generate (ss, ++ss->sequence_allowed);
 
-    ss->sender->kce_task = GNUNET_SCHEDULER_add_delayed (
-      WORKING_QUEUE_INTERVALL,
-      kce_generate_cb,
-      ss);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "We have enough keys.\n");
-    ss_finished = ss;
-    ss->sender->kce_task_finished = GNUNET_YES;
+    if (KCN_TARGET > ss->sender->acks_available)
+    {
+      ss->sender->kce_task = GNUNET_SCHEDULER_add_delayed (
+        WORKING_QUEUE_INTERVALL,
+        kce_generate_cb,
+        ss);
+    }
+    else
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "We have enough keys.\n");
+      ss_finished = ss;
+      ss->sender->kce_task_finished = GNUNET_YES;
+    }
   }
 
 
+
 }
 
 
@@ -1850,7 +1871,17 @@ consider_ss_ack (struct SharedSecret *ss, int initial)
       kce_generate (ss, ++ss->sequence_allowed);
       }*/
 
-  if (((NULL != kce_task) && kce_task_finished) || (GNUNET_NO == initial))
+  if (NULL != kce_task)
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "kce_task is not NULL\n");
+  if (kce_task_finished)
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "kce_task_finished: GNUNET_YES\n");
+  if (initial)
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "initial: GNUNET_YES\n");
+
+  if ( kce_task_finished || (GNUNET_NO == initial))
   {
     struct UDPAck ack;
     struct SharedSecret *ss_tell;
@@ -1877,8 +1908,7 @@ consider_ss_ack (struct SharedSecret *ss, int initial)
     if (GNUNET_NO != initial)
     {
       destroy_all_secrets (ss, GNUNET_YES);
-      kce_task = NULL;
-      kce_task_finished = GNUNET_NO;
+      ss->sender->kce_task_finished = GNUNET_NO;
     }
   }
   else if ((NULL == kce_task) && ((KCN_THRESHOLD >
@@ -2678,8 +2708,10 @@ mq_send_kx (struct GNUNET_MQ_Handle *mq,
                                           receiver->address_len))
     GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending KX to %s\n", GNUNET_a2s (receiver->address,
-                                                receiver->address_len));
+              "Sending KX with payload size %u to %s\n",
+              msize,
+              GNUNET_a2s (receiver->address,
+                          receiver->address_len));
   GNUNET_MQ_impl_send_continue (mq);
 }
 
@@ -2940,7 +2972,8 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
                                             receiver->address_len))
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending UDPBox %u acks left\n",
+                "Sending UDPBox with payload size %u, %u acks left\n",
+                msize,
                 receiver->acks_available);
     GNUNET_MQ_impl_send_continue (mq);
     receiver->acks_available--;
@@ -3135,17 +3168,6 @@ setup_receiver_mq (struct ReceiverAddress *receiver)
                                           receiver->nt,
                                           GNUNET_TRANSPORT_CS_OUTBOUND,
                                           receiver->kx_mq);
-  receiver->d_qh =
-    GNUNET_TRANSPORT_communicator_mq_add (ch,
-                                          &receiver->target,
-                                          receiver->foreign_addr,
-                                          receiver->d_mtu,
-                                          0, /* Initialize with 0 acks */
-                                          1, /* Priority */
-                                          receiver->nt,
-                                          GNUNET_TRANSPORT_CS_OUTBOUND,
-                                          receiver->d_mq);
-
 }
 
 
@@ -3755,9 +3777,11 @@ run (void *cls,
   GNUNET_free (bindto);
   in = (struct sockaddr *) &in_sto;
   in_len = sto_len;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Bound to `%s'\n",
-              GNUNET_a2s ((const struct sockaddr *) &in_sto, sto_len));
+  GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG,
+                           "transport",
+                           "Bound to `%s'\n",
+                           GNUNET_a2s ((const struct sockaddr *) &in_sto,
+                                       sto_len));
   switch (in->sa_family)
   {
   case AF_INET:
@@ -3853,6 +3877,9 @@ main (int argc, char *const *argv)
   };
   int ret;
 
+  GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG,
+                           "transport",
+                           "Starting udp communicator\n");
   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
     return 2;
 
diff --git a/src/transport/gnunet-service-tng.c 
b/src/transport/gnunet-service-tng.c
index a7e2a8c04..a90bef3b5 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -1735,6 +1735,11 @@ struct Queue
    */
   const char *address;
 
+  /**
+   * Is this queue of unlimited length.
+   */
+  unsigned int unlimited_length;
+
   /**
    * Task scheduled for the time when this queue can (likely) transmit the
    * next message.
@@ -1786,6 +1791,11 @@ struct Queue
    */
   unsigned int queue_length;
 
+  /**
+   * Capacity of the queue.
+   */
+  uint64_t q_capacity;
+
   /**
    * Queue priority
    */
@@ -3445,6 +3455,35 @@ static void
 transmit_on_queue (void *cls);
 
 
+/**
+ * Check if the communicator has another queue with higher prio ready for 
sending.
+ */
+static unsigned int
+check_for_queue_with_higher_prio (struct Queue *queue, struct Queue 
*queue_head)
+{
+  for (struct Queue *s = queue_head; NULL != s;
+       s = s->next_client)
+  {
+    if (s->tc->details.communicator.address_prefix !=
+        queue->tc->details.communicator.address_prefix)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "queue address %s qid %u compare with queue: address %s qid 
%u\n",
+                  queue->address,
+                  queue->qid,
+                  s->address,
+                  s->qid);
+      if ((s->priority > queue->priority) && (0 < s->q_capacity) &&
+          (QUEUE_LENGTH_LIMIT > s->queue_length) )
+        return GNUNET_YES;
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Lower prio\n");
+    }
+  }
+  return GNUNET_NO;
+}
+
+
 /**
  * Called whenever something changed that might effect when we
  * try to do the next transmission on @a queue using #transmit_on_queue().
@@ -3456,6 +3495,11 @@ static void
 schedule_transmit_on_queue (struct Queue *queue,
                             enum GNUNET_SCHEDULER_Priority p)
 {
+  if (check_for_queue_with_higher_prio (queue,
+                                        queue->tc->details.communicator.
+                                        queue_head))
+    return;
+
   if (queue->tc->details.communicator.total_queue_length >=
       COMMUNICATOR_TOTAL_QUEUE_LIMIT)
   {
@@ -3480,6 +3524,19 @@ schedule_transmit_on_queue (struct Queue *queue,
     queue->idle = GNUNET_NO;
     return;
   }
+  if (0 == queue->q_capacity)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Transmission throttled due to communicator message queue qid 
%u has capacity %lu.\n",
+                queue->qid,
+                queue->q_capacity);
+    GNUNET_STATISTICS_update (GST_stats,
+                              "# Transmission throttled due to message queue 
capacity",
+                              1,
+                              GNUNET_NO);
+    queue->idle = GNUNET_NO;
+    return;
+  }
   /* queue might indeed be ready, schedule it */
   if (NULL != queue->transmit_task)
     GNUNET_SCHEDULER_cancel (queue->transmit_task);
@@ -3582,8 +3639,9 @@ free_queue (struct Queue *queue)
                                 tc->details.communicator.queue_head,
                                 tc->details.communicator.queue_tail,
                                 queue);
-  maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT >=
-            tc->details.communicator.total_queue_length);
+  maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <=
+            tc->details.communicator.
+            total_queue_length);
   while (NULL != (qe = queue->queue_head))
   {
     GNUNET_CONTAINER_DLL_remove (queue->queue_head, queue->queue_tail, qe);
@@ -3597,7 +3655,7 @@ free_queue (struct Queue *queue)
     GNUNET_free (qe);
   }
   GNUNET_assert (0 == queue->queue_length);
-  if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT <
+  if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT >
                    tc->details.communicator.total_queue_length))
   {
     /* Communicator dropped below threshold, resume all _other_ queues */
@@ -4223,18 +4281,36 @@ queue_send_msg (struct Queue *queue,
     if (NULL != pm)
     {
       qe->pm = pm;
-      GNUNET_assert (NULL == pm->qe);
+      // TODO Why do we have a retransmission. When we know, make decision if 
we still want this.
+      // GNUNET_assert (NULL == pm->qe);
+      /*if (NULL != pm->qe)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Retransmitting message <%llu> remove pm from qe with MID: 
%llu \n",
+                    pm->logging_uuid,
+                    (unsigned long long) pm->qe->mid);
+        pm->qe->pm = NULL;
+        }*/
       pm->qe = qe;
     }
     GNUNET_CONTAINER_DLL_insert (queue->queue_head, queue->queue_tail, qe);
     GNUNET_assert (CT_COMMUNICATOR == queue->tc->type);
     queue->queue_length++;
     queue->tc->details.communicator.total_queue_length++;
+    if (GNUNET_NO == queue->unlimited_length)
+      queue->q_capacity--;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Queue %s with qid %u has capacity %lu\n",
+                queue->address,
+                queue->qid,
+                queue->q_capacity);
     if (COMMUNICATOR_TOTAL_QUEUE_LIMIT ==
         queue->tc->details.communicator.total_queue_length)
       queue->idle = GNUNET_NO;
     if (QUEUE_LENGTH_LIMIT == queue->queue_length)
       queue->idle = GNUNET_NO;
+    if (0 == queue->q_capacity)
+      queue->idle = GNUNET_NO;
     GNUNET_MQ_send (queue->tc->mq, env);
   }
 }
@@ -4672,8 +4748,16 @@ route_control_message_without_fc (const struct 
GNUNET_PeerIdentity *target,
   struct GNUNET_TIME_Relative rtt1;
   struct GNUNET_TIME_Relative rtt2;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Trying to route message of type %u to %s without fc\n",
+              ntohs (hdr->type),
+              GNUNET_i2s (target));
+
+  // TODO Do this elsewhere. vl should be given as parameter to method.
   vl = lookup_virtual_link (target);
   GNUNET_assert (NULL != vl);
+  if (NULL == vl)
+    return GNUNET_TIME_UNIT_FOREVER_REL;
   n = vl->n;
   dv = (0 != (options & RMO_DV_ALLOWED)) ? vl->dv : NULL;
   if (0 == (options & RMO_UNCONFIRMED_ALLOWED))
@@ -4718,6 +4802,10 @@ route_control_message_without_fc (const struct 
GNUNET_PeerIdentity *target,
   rtt2 = GNUNET_TIME_UNIT_FOREVER_REL;
   if (NULL != n)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Try to route message of type %u to %s without fc via 
neighbour\n",
+                ntohs (hdr->type),
+                GNUNET_i2s (target));
     rtt1 = route_via_neighbour (n, hdr, options);
   }
   if (NULL != dv)
@@ -4889,7 +4977,9 @@ check_vl_transmission (struct VirtualLink *vl)
         schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT);
       else
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Queue busy or invalid\n");
+                    "Neighbour Queue QID: %u (%u) busy or invalid\n",
+                    queue->qid,
+                    queue->idle);
     }
   }
   /* Notify queues via DV that we are interested */
@@ -4910,6 +5000,11 @@ check_vl_transmission (struct VirtualLink *vl)
             (queue->validated_until.abs_value_us > now.abs_value_us))
           schedule_transmit_on_queue (queue,
                                       GNUNET_SCHEDULER_PRIORITY_BACKGROUND);
+        else
+          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                      "DV Queue QID: %u (%u) busy or invalid\n",
+                      queue->qid,
+                      queue->idle);
     }
   }
 }
@@ -4996,8 +5091,9 @@ handle_communicator_backchannel (
     (const struct GNUNET_MessageHeader *) &cb[1];
   uint16_t isize = ntohs (inbox->size);
   const char *is = ((const char *) &cb[1]) + isize;
+  size_t slen = strlen (is) + 1;
   char
-    mbuf[isize
+    mbuf[slen + isize
          + sizeof(struct
                   TransportBackchannelEncapsulationMessage)] GNUNET_ALIGN;
   struct TransportBackchannelEncapsulationMessage *be =
@@ -5006,9 +5102,10 @@ handle_communicator_backchannel (
   /* 0-termination of 'is' was checked already in
    #check_communicator_backchannel() */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Preparing backchannel transmission to %s:%s of type %u\n",
+              "Preparing backchannel transmission to %s:%s of type %u and size 
%u\n",
               GNUNET_i2s (&cb->pid),
               is,
+              ntohs (inbox->type),
               ntohs (inbox->size));
   /* encapsulate and encrypt message */
   be->header.type =
@@ -5264,6 +5361,11 @@ handle_raw_message (void *cls, const struct 
GNUNET_MessageHeader *mh)
   uint16_t size = ntohs (mh->size);
   int have_core;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Handling message of type %u with %u bytes\n",
+              (unsigned int) ntohs (mh->type),
+              (unsigned int) ntohs (mh->size));
+
   if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
       (size < sizeof(struct GNUNET_MessageHeader)))
   {
@@ -5290,6 +5392,10 @@ handle_raw_message (void *cls, const struct 
GNUNET_MessageHeader *mh)
                               1,
                               GNUNET_NO);
 
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "CORE messages of type %u with %u bytes dropped (virtual link 
still down)\n",
+                (unsigned int) ntohs (mh->type),
+                (unsigned int) ntohs (mh->size));
     finish_cmc_handling (cmc);
     return;
   }
@@ -5299,7 +5405,10 @@ handle_raw_message (void *cls, const struct 
GNUNET_MessageHeader *mh)
                               "# CORE messages dropped (FC arithmetic 
overflow)",
                               1,
                               GNUNET_NO);
-
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "CORE messages of type %u with %u bytes dropped (FC arithmetic 
overflow)\n",
+                (unsigned int) ntohs (mh->type),
+                (unsigned int) ntohs (mh->size));
     finish_cmc_handling (cmc);
     return;
   }
@@ -5309,6 +5418,10 @@ handle_raw_message (void *cls, const struct 
GNUNET_MessageHeader *mh)
                               "# CORE messages dropped (FC window overflow)",
                               1,
                               GNUNET_NO);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "CORE messages of type %u with %u bytes dropped (FC window 
overflow)\n",
+                (unsigned int) ntohs (mh->type),
+                (unsigned int) ntohs (mh->size));
     finish_cmc_handling (cmc);
     return;
   }
@@ -5345,6 +5458,10 @@ handle_raw_message (void *cls, const struct 
GNUNET_MessageHeader *mh)
        perspective of the other peer! */
     vl->incoming_fc_window_size_used += size;
     /* TODO-M1 */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Dropped message of type %u with %u bytes to CORE: no CORE 
client connected!",
+                (unsigned int) ntohs (mh->type),
+                (unsigned int) ntohs (mh->size));
     finish_cmc_handling (cmc);
     return;
   }
@@ -6074,6 +6191,15 @@ handle_backchannel_encapsulation (
     (const struct GNUNET_MessageHeader *) &be[1];
   uint16_t isize = ntohs (inbox->size);
   const char *target_communicator = ((const char *) inbox) + isize;
+  char *sender;
+  char *self;
+
+  GNUNET_asprintf (&sender,
+                   "%s",
+                   GNUNET_i2s (&cmc->im.sender));
+  GNUNET_asprintf (&self,
+                   "%s",
+                   GNUNET_i2s (&GST_my_identity));
 
   /* Find client providing this communicator */
   for (tc = clients_head; NULL != tc; tc = tc->next)
@@ -6095,8 +6221,9 @@ handle_backchannel_encapsulation (
   }
   /* Finally, deliver backchannel message to communicator */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Delivering backchannel message from %s of type %u to %s\n",
-              GNUNET_i2s (&cmc->im.sender),
+              "Delivering backchannel message from %s to %s of type %u to 
%s\n",
+              sender,
+              self,
               ntohs (inbox->type),
               target_communicator);
   env = GNUNET_MQ_msg_extra (
@@ -8407,14 +8534,15 @@ fragment_message (struct Queue *queue,
   struct PendingMessage *ff;
   uint16_t mtu;
 
-  mtu = (0 == queue->mtu)
+  mtu = (UINT16_MAX == queue->mtu)
         ? UINT16_MAX - sizeof(struct GNUNET_TRANSPORT_SendMessageTo)
         : queue->mtu;
   set_pending_message_uuid (pm);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Fragmenting message %llu <%llu> to %s for MTU %u\n",
+              "Fragmenting message %llu <%llu> with size %u to %s for MTU 
%u\n",
               (unsigned long long) pm->msg_uuid.uuid,
               pm->logging_uuid,
+              pm->bytes_msg,
               GNUNET_i2s (&pm->vl->target),
               (unsigned int) mtu);
   pa = prepare_pending_acknowledgement (queue, dvh, pm);
@@ -8700,7 +8828,7 @@ select_best_pending_from_link (struct 
PendingMessageScoreContext *sc,
                                               GNUNET_TRANSPORT_SendMessageTo))
         ||
         (NULL != pos->head_frag /* fragments already exist, should
-                                     respect that even if MTU is 0 for
+                                     respect that even if MTU is UINT16_MAX for
                                      this queue */))
     {
       frag = GNUNET_YES;
@@ -9069,12 +9197,17 @@ handle_send_message_ack (void *cls,
          qep = qep->next)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "QueueEntry MID: %llu, Ack MID: %llu\n",
+                  "QueueEntry MID: %llu on queue QID: %llu, Ack MID: %llu\n",
                   (unsigned long long) qep->mid,
+                  (unsigned long long) queue->qid,
                   (unsigned long long) sma->mid);
       if (qep->mid != sma->mid)
         continue;
       qe = qep;
+      if ((NULL != qe->pm)&&(qe->pm->qe != qe))
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "For pending message %llu we had retransmissions.\n",
+                    qe->pm->logging_uuid);
       break;
     }
   }
@@ -9125,12 +9258,26 @@ handle_send_message_ack (void *cls,
                               GNUNET_NO);
     schedule_transmit_on_queue (qe->queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT);
   }
+  else if (1 == qe->queue->q_capacity)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Transmission rescheduled due to communicator message queue 
with qid %u has capacity %lu.\n",
+                qe->queue->qid,
+                qe->queue->q_capacity);
+    /* message queue has capacity; only resume this one queue */
+    /* queue dropped below threshold; only resume this one queue */
+    GNUNET_STATISTICS_update (GST_stats,
+                              "# Transmission throttled due to message queue 
capacity",
+                              -1,
+                              GNUNET_NO);
+    schedule_transmit_on_queue (qe->queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT);
+  }
 
   if (NULL != (pm = qe->pm))
   {
     struct VirtualLink *vl;
 
-    GNUNET_assert (qe == pm->qe);
+    // GNUNET_assert (qe == pm->qe);
     pm->qe = NULL;
     /* If waiting for this communicator may have blocked transmission
        of pm on other queues for this neighbour, force schedule
@@ -9671,16 +9818,20 @@ handle_add_queue_message (void *cls,
     addr_len = ntohs (aqm->header.size) - sizeof(*aqm);
     addr = (const char *) &aqm[1];
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "New queue %s to %s available with QID %llu\n",
+                "New queue %s to %s available with QID %llu and q_len %lu \n",
                 addr,
                 GNUNET_i2s (&aqm->receiver),
-                (unsigned long long) aqm->qid);
+                (unsigned long long) aqm->qid,
+                GNUNET_ntohll (aqm->q_len));
     queue = GNUNET_malloc (sizeof(struct Queue) + addr_len);
     queue->tc = tc;
     queue->address = (const char *) &queue[1];
     queue->pd.aged_rtt = GNUNET_TIME_UNIT_FOREVER_REL;
     queue->qid = aqm->qid;
     queue->neighbour = neighbour;
+    if (GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED == GNUNET_ntohll (aqm->q_len))
+      queue->unlimited_length = GNUNET_YES;
+    queue->q_capacity = GNUNET_ntohll (aqm->q_len);
     memcpy (&queue[1], addr, addr_len);
     /* notify monitors about new queue */
     {
@@ -9752,10 +9903,14 @@ handle_update_queue_message (void *cls,
   target_queue->mtu = ntohl (msg->mtu);
   target_queue->cs = msg->cs;
   target_queue->priority = ntohl (msg->priority);
-  /* The update message indicates how many _additional_
-   * messages the queue should be able to handle
+  /* The update message indicates how many messages
+   * the queue should be able to handle.
    */
-  target_queue->queue_length += GNUNET_ntohll (msg->q_len);
+  if (GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED == GNUNET_ntohll (msg->q_len))
+    target_queue->unlimited_length = GNUNET_YES;
+  else
+    target_queue->unlimited_length = GNUNET_NO;
+  target_queue->q_capacity = GNUNET_ntohll (msg->q_len);
   GNUNET_SERVICE_client_continue (tc->client);
 }
 
@@ -10179,8 +10334,18 @@ static void
 shutdown_task (void *cls)
 {
   in_shutdown = GNUNET_YES;
+
   if (NULL == clients_head)
-    do_shutdown (cls);
+  {
+    for (struct TransportClient *tc = clients_head; NULL != tc; tc = tc->next)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "client still connected: %u\n",
+                  tc->type);
+    }
+  }
+  do_shutdown (cls);
+
 }
 
 
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c 
b/src/transport/test_transport_plugin_cmd_simple_send.c
index 07255a1a5..b578219ca 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -180,7 +180,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, 
char *router_ip,
     GNUNET_TESTING_cmd_system_destroy ("system-destroy",
                                        "system-create"),
     GNUNET_TESTING_cmd_local_test_finished ("local-test-finished",
-                                            write_message)
+                                            write_message),
+    GNUNET_TESTING_cmd_end_without_shutdown ()
   };
 
   GNUNET_TESTING_run (NULL,
@@ -201,6 +202,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_init (void 
*cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api;
 
+  GNUNET_log_setup ("simple-send",
+                    "DEBUG",
+                    NULL);
+
   api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions);
   api->start_testcase = &start_testcase;
   api->all_peers_started = &all_peers_started;
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_v2.c 
b/src/transport/test_transport_plugin_cmd_simple_send_v2.c
index c79b5c7e2..acfe784d6 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_v2.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_v2.c
@@ -185,7 +185,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, 
char *router_ip,
     GNUNET_TESTING_cmd_system_destroy ("system-destroy",
                                        "system-create"),
     GNUNET_TESTING_cmd_local_test_finished ("local-test-finished",
-                                            write_message)
+                                            write_message),
+    GNUNET_TESTING_cmd_end_without_shutdown ()
   };
 
   GNUNET_TESTING_run (NULL,
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c 
b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 90e474aea..e2e0b258b 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -57,6 +57,12 @@ char *cfgname;
  */
 unsigned int are_all_peers_started;
 
+/**
+ * Flag indicating if all local tests are prepared to finish.
+ *
+ */
+unsigned int are_all_local_tests_prepared;
+
 /**
  * Flag indicating a received message.
  */
@@ -85,6 +91,8 @@ static void
 handle_test (void *cls,
              const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Message received.\n");
   message_received = GNUNET_YES;
 }
 
@@ -103,6 +111,16 @@ all_peers_started ()
 }
 
 
+/**
+ * Callback to set the flag indicating all peers are prepared to finish. Will 
be called via the plugin api.
+ */
+static void
+all_local_tests_prepared ()
+{
+  are_all_local_tests_prepared = GNUNET_YES;
+}
+
+
 /**
  * Function to start a local test case.
  *
@@ -179,17 +197,23 @@ start_testcase (TESTING_CMD_HELPER_write_cb 
write_message, char *router_ip,
                                            "system-create",
                                            num,
                                            topology),
-    GNUNET_TRANSPORT_cmd_send_simple_v2 ("send-simple",
-                                         "start-peer",
-                                         num),
-    GNUNET_TESTING_cmd_block_until_external_trigger ("block-receive",
-                                                     &message_received),
+    GNUNET_TRANSPORT_cmd_backchannel_check ("backchannel-check",
+                                            "start-peer",
+                                            "system-create",
+                                            num,
+                                            m_int,
+                                            n_int,
+                                            topology),
+    GNUNET_TESTING_cmd_local_test_prepared ("local-test-prepared",
+                                            write_message,
+                                            &are_all_local_tests_prepared),
     GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer",
                                     "start-peer"),
     GNUNET_TESTING_cmd_system_destroy ("system-destroy",
                                        "system-create"),
     GNUNET_TESTING_cmd_local_test_finished ("local-test-finished",
-                                            write_message)
+                                            write_message),
+    GNUNET_TESTING_cmd_end_without_shutdown ()
   };
 
   GNUNET_TESTING_run (NULL,
@@ -217,6 +241,7 @@ libgnunet_test_transport_plugin_cmd_udp_backchannel_init 
(void *cls)
   api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions);
   api->start_testcase = &start_testcase;
   api->all_peers_started = &all_peers_started;
+  api->all_local_tests_prepared = all_local_tests_prepared;
   return api;
 }
 
diff --git a/src/transport/test_transport_udp_backchannel.sh 
b/src/transport/test_transport_udp_backchannel.sh
index 3322e5853..0c37be469 100755
--- a/src/transport/test_transport_udp_backchannel.sh
+++ b/src/transport/test_transport_udp_backchannel.sh
@@ -1,2 +1,4 @@
 #!/bin/bash
+#exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; 
valgrind --leak-check=full --track-origins=yes --trace-children=yes 
--trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip 
./test_transport_start_with_config test_transport_udp_backchannel_topo.conf"
 exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; 
./test_transport_start_with_config test_transport_udp_backchannel_topo.conf"
+# exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs 
/run/netns; valgrind --leak-check=full --track-origins=yes 
./test_transport_start_with_config test_transport_udp_backchannel_topo.conf"
diff --git a/src/transport/transport-testing-cmds.h 
b/src/transport/transport-testing-cmds.h
index ecdabd35f..67e5723f5 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -228,22 +228,36 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
                                  struct GNUNET_MQ_MessageHandler *handlers,
                                  const char *cfgname);
 
+
 struct GNUNET_TESTING_Command
 GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
                                 const char *start_label);
 
+
 struct GNUNET_TESTING_Command
 GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
                                     const char *start_peer_label,
                                     const char *create_label,
                                     uint32_t num);
 
+
 struct GNUNET_TESTING_Command
 GNUNET_TRANSPORT_cmd_connect_peers_v2 (const char *label,
                                        const char *start_peer_label,
                                        const char *create_label,
                                        uint32_t num);
 
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @param create_label Label of the cmd to create the testing system.
+ * @param num Number globally identifying the node.
+ * @param The topology for the test setup.
+ * @return command.
+ */
 struct GNUNET_TESTING_Command
 GNUNET_TRANSPORT_cmd_connect_peers_v3 (const char *label,
                                        const char *start_peer_label,
@@ -252,6 +266,40 @@ GNUNET_TRANSPORT_cmd_connect_peers_v3 (const char *label,
                                        struct GNUNET_TESTING_NetjailTopology *
                                        topology);
 
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @param create_label Label of the cmd to create the testing system.
+ * @param num Number globally identifying the node.
+ * @param node_n The number of the node in a network namespace.
+ * @param namespace_n The number of the network namespace.
+ * @param The topology for the test setup.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
+                                        const char *start_peer_label,
+                                        const char *create_label,
+                                        uint32_t num,
+                                        unsigned int node_n,
+                                        unsigned int namespace_n,
+                                        struct GNUNET_TESTING_NetjailTopology *
+                                        topology);
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param m The number of the local node of the actual network namespace.
+ * @param n The number of the actual namespace.
+ * @param num Number globally identifying the node.
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @return command.
+ */
 struct GNUNET_TESTING_Command
 GNUNET_TRANSPORT_cmd_send_simple (const char *label,
                                   char *m,
@@ -263,10 +311,8 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label,
  * Create command.
  *
  * @param label name for command.
- * @param m The number of the local node of the actual network namespace.
- * @param n The number of the actual namespace.
- * @param num Number globally identifying the node.
  * @param start_peer_label Label of the cmd to start a peer.
+ * @param num Number globally identifying the node.
  * @return command.
  */
 struct GNUNET_TESTING_Command
@@ -274,6 +320,26 @@ GNUNET_TRANSPORT_cmd_send_simple_v2 (const char *label,
                                      const char *start_peer_label,
                                      uint32_t num);
 
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @param start_peer_label Label of the cmd which started the test system.
+ * @param num Number globally identifying the node.
+ * @param The topology for the test setup.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TRANSPORT_cmd_send_simple_v3 (const char *label,
+                                     const char *start_peer_label,
+                                     const char *create_label,
+                                     uint32_t num,
+                                     struct GNUNET_TESTING_NetjailTopology *
+                                     topology);
+
+
 int
 GNUNET_TRANSPORT_get_trait_peer_id (const struct
                                     GNUNET_TESTING_Command *cmd,
diff --git a/src/transport/transport_api2_communication.c 
b/src/transport/transport_api2_communication.c
index 446add6f6..2a80db87b 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -904,6 +904,10 @@ GNUNET_TRANSPORT_communicator_receive (
   struct GNUNET_TRANSPORT_IncomingMessage *im;
   uint16_t msize;
 
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "communicator receive\n");
+
   if (NULL == ch->mq)
     return GNUNET_SYSERR;
   if ((NULL == cb) && (GNUNET_MQ_get_length (ch->mq) >= ch->max_queue_length))
@@ -986,6 +990,9 @@ GNUNET_TRANSPORT_communicator_mq_add (
 {
   struct GNUNET_TRANSPORT_QueueHandle *qh;
 
+  // Do not notify the service if there is no intial capacity.
+  GNUNET_assert (0 < q_len);
+
   qh = GNUNET_new (struct GNUNET_TRANSPORT_QueueHandle);
   qh->ch = ch;
   qh->peer = *peer;
@@ -1106,7 +1113,7 @@ GNUNET_TRANSPORT_communicator_address_remove (
  */
 void
 GNUNET_TRANSPORT_communicator_address_remove_all (
-                                              struct 
GNUNET_TRANSPORT_CommunicatorHandle *ch)
+  struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
 {
   for (struct GNUNET_TRANSPORT_AddressIdentifier *ai = ch->ai_head; NULL != ai;
        ai = ai->next)
diff --git a/src/transport/transport_api_cmd_backchannel_check.c 
b/src/transport/transport_api_cmd_backchannel_check.c
new file mode 100644
index 000000000..da44e91ca
--- /dev/null
+++ b/src/transport/transport_api_cmd_backchannel_check.c
@@ -0,0 +1,628 @@
+/*
+      This file is part of GNUnet
+      Copyright (C) 2021 GNUnet e.V.
+
+      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
+      Affero General Public License for more details.
+
+      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 testing_api_cmd_backchannel_check.c
+ * @brief cmd to start a peer.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+#include "gnunet_transport_application_service.h"
+#include "gnunet_hello_lib.h"
+#include "gnunet_transport_service.h"
+#include "transport-testing-cmds.h"
+
+/**
+ * Generic logging shortcut
+ */
+#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
+
+#define UDP "udp"
+
+/**
+ * Maximum length allowed for line input.
+ */
+#define MAX_LINE_LENGTH 1024
+
+/**
+ * Struct to store information needed in callbacks.
+ *
+ */
+struct CheckState
+{
+  /**
+   * The number of the node in a network namespace.
+   */
+  unsigned int node_n;
+
+  /**
+   * The number of the network namespace.
+   */
+  unsigned int namespace_n;
+
+  /**
+   * The testing system of this node.
+   */
+  struct GNUNET_TESTING_System *tl_system;
+
+  // Label of the cmd which started the test system.
+  const char *create_label;
+
+  /**
+   * Number globally identifying the node.
+   *
+   */
+  uint32_t num;
+
+  /**
+   * Label of the cmd to start a peer.
+   *
+   */
+  const char *start_peer_label;
+
+  /**
+   * The topology of the test setup.
+   */
+  struct GNUNET_TESTING_NetjailTopology *topology;
+
+  /**
+   * Connections to other peers.
+   */
+  struct GNUNET_TESTING_NodeConnection *node_connections_head;
+
+  /**
+   * Number of connections.
+   */
+  unsigned int con_num;
+
+  /**
+   * Number of received backchannel messages.
+   */
+  unsigned int received_backchannel_msgs;
+
+  /**
+   * Array with search strings.
+   */
+  char **search_string;
+
+  /**
+   * File handle for log file.
+   */
+  struct GNUNET_DISK_FileHandle *fh;
+
+  /**
+   * Task which handles the reading
+   */
+  struct GNUNET_SCHEDULER_Task *task;
+
+  /**
+   * Stream to read log file lines.
+   */
+  FILE *stream;
+
+  /**
+   * Did we get all bachchannel messages.
+   */
+  enum GNUNET_GenericReturnValue finished;
+};
+
+/**
+ *
+ * @param cls The cmd state CheckState.
+ */
+static void
+read_from_log (void *cls)
+{
+  struct CheckState *cs = cls;
+  char line[MAX_LINE_LENGTH + 1];
+  char *search_string;
+
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "read_from_log\n");
+
+  cs->fh = GNUNET_DISK_file_open ("test.out",
+                                  GNUNET_DISK_OPEN_READ,
+                                  GNUNET_DISK_PERM_USER_READ);
+
+  cs->task = NULL;
+
+  /* read message from line and handle it */
+  cs->stream = fdopen (cs->fh->fd, "r");
+  memset (line, 0, MAX_LINE_LENGTH + 1);
+
+  // fgets (line, MAX_LINE_LENGTH, cs->stream);
+  // while (NULL != line &&  0 != strcmp (line, ""))// '\0' != line[0])
+  while  (NULL != fgets (line, MAX_LINE_LENGTH, cs->stream))
+  {
+    /*LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "cs->received_backchannel_msgs: %u\n",
+         cs->received_backchannel_msgs);*/
+    /*if (NULL == strstr (line, "line"))
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "line: %s",
+           line);*/
+
+
+    for (int i = 0; i < cs->con_num; i++)
+    {
+      search_string = cs->search_string[i];
+      /*LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "search %u %u: %s %p\n",
+           i,
+           cs->con_num,
+           cs->search_string[i],
+           cs->search_string);
+      fprintf (stderr,
+      line);*/
+      if (NULL != strstr (line,
+                          search_string))
+      // "Delivering backchannel message from 4TTC to F7B5 of type 1460 to 
udp"))
+      // cs->search_string[i]))
+      {
+        cs->received_backchannel_msgs++;
+        LOG (GNUNET_ERROR_TYPE_DEBUG,
+             "received_backchannel_msgs %u con_num %u\n",
+             cs->received_backchannel_msgs,
+             cs->con_num);
+        if (cs->received_backchannel_msgs == cs->con_num)
+        {
+          LOG (GNUNET_ERROR_TYPE_DEBUG,
+               "search finished %lu %lu %u\n",
+               strlen (cs->search_string[i]),
+               strlen (
+                 "Delivering backchannel message from 4TTC to F7B5 of type 
1460 to udp"),
+               strcmp (
+                 "Delivering backchannel message from 4TTC to F7B5 of type 
1460 to udp",
+                 cs->search_string[i]));
+          if (NULL != strstr (line,
+                              cs->search_string[i]))
+          {
+            LOG (GNUNET_ERROR_TYPE_DEBUG,
+                 "gaga\n");
+          }
+          cs->finished = GNUNET_YES;
+          fclose (cs->stream);
+          return;
+        }
+      }
+    }
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "read_from_log end\n");
+  fclose (cs->stream);
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
+                                &read_from_log,
+                                cs);
+  /*if (NULL == fgets (line, MAX_LINE_LENGTH, cs->stream))
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "read null\n");
+    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+                                  &read_from_log,
+                                  cs);
+    return;
+    }*/
+  /*else {
+    cs->task =
+      GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
+                                      cs->fh,
+                                      &read_from_log,
+                                      cs);
+
+
+                                      }*/
+}
+
+
+static enum GNUNET_GenericReturnValue
+will_the_other_node_connect_via_udp (
+  struct CheckState *cs,
+  const struct GNUNET_TESTING_NetjailNode *node)
+// struct GNUNET_TESTING_NodeConnection *connection)
+{
+  // struct GNUNET_TESTING_NetjailTopology *topology = cs->topology;
+  // unsigned int node_n = connection->node_n;
+  // unsigned int namespace_n = connection->namespace_n;
+  // struct GNUNET_HashCode hc;
+  // struct GNUNET_ShortHashCode *key = GNUNET_new (struct 
GNUNET_ShortHashCode);
+  // struct GNUNET_HashCode hc_namespace;
+  /*struct GNUNET_ShortHashCode *key_namespace = GNUNET_new (struct
+    GNUNET_ShortHashCode);*/
+  // struct GNUNET_TESTING_NetjailNode *node;
+  struct GNUNET_TESTING_NodeConnection *pos_connection;
+  struct GNUNET_TESTING_AddressPrefix *pos_prefix;
+  // struct GNUNET_TESTING_NetjailNamespace *namespace;
+  // struct GNUNET_CONTAINER_MultiShortmap *map;
+
+  /* if (0 == connection->namespace_n) */
+  /* { */
+  /*   map = topology->map_globals; */
+  /* } */
+  /* else */
+  /* { */
+  /*   GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc_namespace); 
*/
+  /*   memcpy (key_namespace, */
+  /*           &hc_namespace, */
+  /*           sizeof (*key_namespace)); */
+  /*   if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( */
+  /*         topology->map_namespaces, */
+  /*         key_namespace)) */
+  /*   { */
+  /*     namespace = GNUNET_CONTAINER_multishortmap_get 
(topology->map_namespaces, */
+  /*                                                     key_namespace); */
+  /*     map = namespace->nodes; */
+  /*   } */
+  /*   else */
+  /*     GNUNET_assert (0); */
+  /* } */
+
+  /* GNUNET_CRYPTO_hash (&node_n, sizeof(node_n), &hc); */
+  /* memcpy (key, */
+  /*         &hc, */
+  /*         sizeof (*key)); */
+  /* if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( */
+  /*       map, */
+  /*       key)) */
+  /* { */
+  /*   node = GNUNET_CONTAINER_multishortmap_get (cs->topology->map_globals, */
+  /*                                              key); */
+  /*   for (pos_connection = node->node_connections_head; NULL != 
pos_connection; */
+  /*        pos_connection = pos_connection->next) */
+  /*   { */
+  /*     if ((node->namespace_n == pos_connection->namespace_n) && */
+  /*         (node->node_n == pos_connection->node_n) ) */
+  /*     { */
+  /*       for (pos_prefix = pos_connection->address_prefixes_head; NULL != */
+  /*            pos_prefix; */
+  /*            pos_prefix = */
+  /*              pos_prefix->next) */
+  /*       { */
+  /*         if (0 == strcmp (UDP, pos_prefix->address_prefix)) */
+  /*         { */
+  /*           return GNUNET_YES; */
+  /*         } */
+  /*       } */
+  /*     } */
+  /*   } */
+  /* } */
+
+  for (pos_connection = node->node_connections_head; NULL != pos_connection;
+       pos_connection = pos_connection->next)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "connect via udp %u %u %u %u\n",
+                node->namespace_n,
+                cs->namespace_n,
+                node->node_n,
+                cs->node_n);
+    if ((pos_connection->namespace_n == cs->namespace_n) &&
+        (pos_connection->node_n == cs->node_n) )
+    {
+      for (pos_prefix = pos_connection->address_prefixes_head; NULL !=
+           pos_prefix;
+           pos_prefix =
+             pos_prefix->next)
+      {
+        if (0 == strcmp (UDP, pos_prefix->address_prefix))
+        {
+          return GNUNET_YES;
+        }
+      }
+    }
+  }
+
+  return GNUNET_NO;
+}
+
+static void
+add_search_string (struct CheckState *cs, const struct
+                   GNUNET_TESTING_NetjailNode *node)
+{
+  unsigned int num;
+  struct GNUNET_PeerIdentity *peer;
+  struct GNUNET_PeerIdentity *us;
+  char *buf;
+  char *part_one = "Delivering backchannel message from ";
+  char *part_two = " to ";
+  char *part_three = " of type 1460 to udp";
+  char *peer_id;
+  char *us_id;
+
+  if (0 == node->namespace_n)
+    num = node->node_n;
+  else
+    num = (node->namespace_n - 1) * cs->topology->nodes_m + node->node_n
+          + cs->topology->nodes_x;
+
+  // num = GNUNET_TESTING_calculate_num (pos_connection, cs->topology);
+  peer = GNUNET_TESTING_get_pub_key (num, cs->tl_system);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "peer: %s num %u\n",
+       GNUNET_i2s (peer),
+       num);
+  us = GNUNET_TESTING_get_pub_key (cs->num, cs->tl_system);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "us: %s cs->num %d\n",
+       GNUNET_i2s (us),
+       cs->num);
+
+  GNUNET_asprintf (&peer_id,
+                   "%s",
+                   GNUNET_i2s (peer));
+  GNUNET_asprintf (&us_id,
+                   "%s",
+                   GNUNET_i2s (us));
+
+  if (0 < GNUNET_asprintf (&buf,
+                           "%s%s%s%s%s",
+                           part_one,
+                           us_id,
+                           part_two,
+                           peer_id,
+                           part_three))
+  {
+    GNUNET_array_append (cs->search_string,
+                         cs->con_num,
+                         buf);
+    /*LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "con_num: %u search: %s %p\n",
+         cs->con_num,
+         cs->search_string[cs->con_num - 1],
+         cs->search_string);*/
+  }
+  else
+    GNUNET_assert (0);
+}
+
+
+/**
+ * The run method of this cmd will connect to peers.
+ *
+ */
+static void
+backchannel_check_run (void *cls,
+                       const struct GNUNET_TESTING_Command *cmd,
+                       struct GNUNET_TESTING_Interpreter *is)
+{
+  struct CheckState *cs = cls;
+  // char *buf;
+  // char *part_one = "Delivering backchannel message from ";
+  // char *part_two = " of type 1460 to udp";
+  const struct GNUNET_TESTING_Command *system_cmd;
+  struct GNUNET_TESTING_System *tl_system;
+  const struct GNUNET_TESTING_Command *peer1_cmd;
+  struct GNUNET_TRANSPORT_ApplicationHandle *ah;
+  // struct GNUNET_PeerIdentity *peer;
+  // uint32_t num;
+  // struct GNUNET_TESTING_NodeConnection *pos_connection;
+  // unsigned int con_num = 0;
+  struct GNUNET_CONTAINER_MultiShortmapIterator *node_it;
+  struct GNUNET_CONTAINER_MultiShortmapIterator *namespace_it;
+  struct GNUNET_ShortHashCode node_key;
+  struct GNUNET_ShortHashCode namespace_key;
+  const struct GNUNET_TESTING_NetjailNode *node;
+  const struct GNUNET_TESTING_NetjailNamespace *namespace;
+
+  peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (
+    cs->start_peer_label);
+  GNUNET_TRANSPORT_get_trait_application_handle_v2 (peer1_cmd,
+                                                    &ah);
+
+  system_cmd = GNUNET_TESTING_interpreter_lookup_command (cs->create_label);
+  GNUNET_TESTING_get_trait_test_system (system_cmd,
+                                        &tl_system);
+
+  cs->tl_system = tl_system;
+
+  cs->node_connections_head = GNUNET_TESTING_get_connections (cs->num,
+                                                              cs->topology);
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "check run\n");
+
+
+  node_it = GNUNET_CONTAINER_multishortmap_iterator_create (
+    cs->topology->map_globals);
+
+  while (GNUNET_YES == GNUNET_CONTAINER_multishortmap_iterator_next (node_it,
+                                                                     &node_key,
+                                                                     (const
+                                                                      void**) &
+                                                                     node))
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "namespace_n %u node_n %u\n",
+         node->namespace_n,
+         node->node_n);
+    if (GNUNET_YES == will_the_other_node_connect_via_udp (cs, node))
+    {
+      add_search_string (cs, node);
+    }
+  }
+  namespace_it = GNUNET_CONTAINER_multishortmap_iterator_create (
+    cs->topology->map_namespaces);
+  while (GNUNET_YES == GNUNET_CONTAINER_multishortmap_iterator_next (
+           namespace_it,
+           &namespace_key,
+           (const
+            void**) &namespace))
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "namespace_n %u\n",
+         node->namespace_n);
+    node_it = GNUNET_CONTAINER_multishortmap_iterator_create (
+      namespace->nodes);
+    while (GNUNET_YES == GNUNET_CONTAINER_multishortmap_iterator_next (node_it,
+                                                                       
&node_key,
+                                                                       (const
+                                                                        void**)
+                                                                       &node))
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "namespace_n %u node_n %u\n",
+           node->namespace_n,
+           node->node_n);
+      if (GNUNET_YES == will_the_other_node_connect_via_udp (cs, node))
+      {
+        add_search_string (cs, node);
+      }
+    }
+  }
+  /* for (pos_connection = cs->node_connections_head; NULL != pos_connection; 
*/
+  /*      pos_connection = pos_connection->next) */
+  /* { */
+
+  /*   if (GNUNET_YES == will_the_other_node_connect_via_udp (cs, node)) */
+  /*   { */
+  /*     num = GNUNET_TESTING_calculate_num (pos_connection, cs->topology); */
+  /*     peer = GNUNET_TESTING_get_pub_key (num, tl_system); */
+  /*     LOG (GNUNET_ERROR_TYPE_DEBUG, */
+  /*          "peer: %s\n", */
+  /*          GNUNET_i2s (peer)); */
+
+  /*     if (0 < GNUNET_asprintf (&buf, */
+  /*                              "%s%s%s", */
+  /*                              part_one, */
+  /*                              GNUNET_i2s (peer), */
+  /*                              part_two)) */
+  /*     { */
+  /*       GNUNET_array_append (cs->search_string, */
+  /*                            con_num, */
+  /*                            buf); */
+  /*       /\*LOG (GNUNET_ERROR_TYPE_DEBUG, */
+  /*            "con_num: %u search: %s %p\n", */
+  /*            con_num, */
+  /*            cs->search_string[con_num - 1], */
+  /*            cs->search_string);*\/ */
+  /*     } */
+  /*     else */
+  /*       GNUNET_assert (0); */
+  /*   } */
+
+
+  /* } */
+  // cs->con_num = con_num;
+  if (0 != cs->con_num)
+  {
+    cs->task =
+      GNUNET_SCHEDULER_add_now (&read_from_log,
+                                cs);
+  }
+  else
+    cs->finished = GNUNET_YES;
+
+}
+
+
+/**
+ * The finish function of this cmd will check if the peers we are trying to
+ * connect to are in the connected peers map of the start peer cmd for this 
peer.
+ *
+ */
+static int
+backchannel_check_finish (void *cls,
+                          GNUNET_SCHEDULER_TaskCallback cont,
+                          void *cont_cls)
+{
+  struct CheckState *cs = cls;
+
+  if (cs->finished)
+  {
+    cont (cont_cls);
+  }
+  return cs->finished;
+}
+
+
+/**
+ * Trait function of this cmd does nothing.
+ *
+ */
+static int
+backchannel_check_traits (void *cls,
+                          const void **ret,
+                          const char *trait,
+                          unsigned int index)
+{
+  return GNUNET_OK;
+}
+
+
+/**
+ * The cleanup function of this cmd frees resources the cmd allocated.
+ *
+ */
+static void
+backchannel_check_cleanup (void *cls,
+                           const struct GNUNET_TESTING_Command *cmd)
+{
+  struct ConnectPeersState *cs = cls;
+
+  GNUNET_free (cs);
+}
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @param create_label Label of the cmd to create the testing system.
+ * @param num Number globally identifying the node.
+ * @param node_n The number of the node in a network namespace.
+ * @param namespace_n The number of the network namespace.
+ * @param The topology for the test setup.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
+                                        const char *start_peer_label,
+                                        const char *create_label,
+                                        uint32_t num,
+                                        unsigned int node_n,
+                                        unsigned int namespace_n,
+                                        struct GNUNET_TESTING_NetjailTopology *
+                                        topology)
+{
+  struct CheckState *cs;
+
+  cs = GNUNET_new (struct CheckState);
+  cs->start_peer_label = start_peer_label;
+  cs->num = num;
+  cs->create_label = create_label;
+  cs->topology = topology;
+  cs->node_n = node_n;
+  cs->namespace_n = namespace_n;
+
+  struct GNUNET_TESTING_Command cmd = {
+    .cls = cs,
+    .label = label,
+    .run = &backchannel_check_run,
+    .finish = &backchannel_check_finish,
+    .cleanup = &backchannel_check_cleanup,
+    .traits = &backchannel_check_traits
+  };
+
+  return cmd;
+}
diff --git a/src/transport/transport_api_cmd_connecting_peers.c 
b/src/transport/transport_api_cmd_connecting_peers.c
index 09ca9e54c..39c7db450 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -91,7 +91,7 @@ connect_peers_run (void *cls,
   char *hello;
   // size_t *hello_size;
   enum GNUNET_NetworkType nt = 0;
-  char *peer_id;
+  // char *peer_id;
   struct GNUNET_PeerIdentity *id;
   struct GNUNET_PeerIdentity *other = GNUNET_new (struct GNUNET_PeerIdentity);
   uint32_t num;
@@ -122,12 +122,12 @@ connect_peers_run (void *cls,
   if (2 == num)
   {
     addr = "tcp-192.168.15.2:60002";
-    peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG";
+    // peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG";
   }
   else
   {
     addr = "tcp-192.168.15.1:60002";
-    peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730";
+    // peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730";
   }
 
   priv_key = GNUNET_TESTING_hostkey_get (tl_system,
@@ -137,16 +137,16 @@ connect_peers_run (void *cls,
   GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
                                       pub_key);
 
-  GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
+  /*GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
                                               strlen (peer_id),
-                                              &peer->public_key);
+                                              &peer->public_key);*/
 
   peer->public_key = *pub_key;
 
   LOG (GNUNET_ERROR_TYPE_ERROR,
-       "\nnum: %u\n peer_id: %s\n pub_key %s\n",
+       "num: %u id: %s pub_key %s\n",
        num,
-       peer_id,
+       GNUNET_i2s_full (id),
        GNUNET_CRYPTO_eddsa_public_key_to_string (pub_key));
 
   cps->id = peer;
diff --git a/src/transport/transport_api_cmd_connecting_peers_v3.c 
b/src/transport/transport_api_cmd_connecting_peers_v3.c
index e90781637..2273d9852 100644
--- a/src/transport/transport_api_cmd_connecting_peers_v3.c
+++ b/src/transport/transport_api_cmd_connecting_peers_v3.c
@@ -36,22 +36,6 @@
  */
 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
 
-#define CONNECT_ADDRESS_TEMPLATE_TCP "tcp-192.168.15.%u:60002"
-
-#define CONNECT_ADDRESS_TEMPLATE_UDP "udp-192.168.15.%u:60002"
-
-#define ROUTER_CONNECT_ADDRESS_TEMPLATE_TCP "tcp-92.68.150.%u:60002"
-
-#define ROUTER_CONNECT_ADDRESS_TEMPLATE_UDP "udp-92.68.150.%u:60002"
-
-#define GLOBAL_CONNECT_ADDRESS_TEMPLATE_TCP "tcp-92.68.151.%u:60002"
-
-#define GLOBAL_CONNECT_ADDRESS_TEMPLATE_UDP "udp-92.68.151.%u:60002"
-
-#define PREFIX_TCP "tcp"
-
-#define PREFIX_UDP "udp"
-
 /**
  * Struct to store information needed in callbacks.
  *
@@ -101,222 +85,6 @@ struct ConnectPeersState
 };
 
 
-static struct GNUNET_PeerIdentity *
-get_pub_key (unsigned int num, struct GNUNET_TESTING_System *tl_system)
-{
-  struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
-  struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct
-                                                             
GNUNET_CRYPTO_EddsaPublicKey);
-  struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct
-                                                               
GNUNET_CRYPTO_EddsaPrivateKey);
-
-  priv_key = GNUNET_TESTING_hostkey_get (tl_system,
-                                         num,
-                                         peer);
-
-  GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
-                                      pub_key);
-  peer->public_key = *pub_key;
-  return peer;
-}
-
-
-static int
-log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
-{
-  struct GNUNET_TESTING_NetjailNode *node = value;
-  struct GNUNET_TESTING_NodeConnection *pos_connection;
-  struct GNUNET_TESTING_ADDRESS_PREFIX *pos_prefix;
-
-  LOG (GNUNET_ERROR_TYPE_ERROR,
-       "plugin: %s space: %u node: %u global: %u\n",
-       node->plugin,
-       node->namespace_n,
-       node->node_n,
-       node->is_global);
-
-  for (pos_connection = node->node_connections_head; NULL != pos_connection;
-       pos_connection = pos_connection->next)
-  {
-
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "namespace_n: %u node_n: %u node_type: %u\n",
-         pos_connection->namespace_n,
-         pos_connection->node_n,
-         pos_connection->node_type);
-
-    for (pos_prefix = pos_connection->address_prefixes_head; NULL != 
pos_prefix;
-         pos_prefix =
-           pos_prefix->next)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           "prefix: %s\n",
-           pos_prefix->address_prefix);
-    }
-  }
-  return GNUNET_YES;
-}
-
-
-static int
-log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
-{
-  struct GNUNET_TESTING_NetjailNamespace *namespace = value;
-  struct GNUNET_TESTING_NetjailRouter *router = namespace->router;
-
-  LOG (GNUNET_ERROR_TYPE_ERROR,
-       "router_tcp: %u router_udp: %u spaces: %u\n",
-       router->tcp_port,
-       router->udp_port,
-       namespace->namespace_n);
-  GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, &log_nodes, NULL);
-  return GNUNET_YES;
-}
-
-
-static int
-log_topo (struct GNUNET_TESTING_NetjailTopology *topology)
-{
-  LOG (GNUNET_ERROR_TYPE_ERROR,
-       "plugin: %s spaces: %u nodes: %u known: %u\n",
-       topology->plugin,
-       topology->namespaces_n,
-       topology->nodes_m,
-       topology->nodes_x);
-
-  GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
-                                          log_namespaces, NULL);
-  GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, &log_nodes,
-                                          NULL);
-  return GNUNET_YES;
-}
-
-
-static struct GNUNET_TESTING_NodeConnection *
-get_connections (unsigned int num, struct
-                 GNUNET_TESTING_NetjailTopology *topology)
-{
-  struct GNUNET_TESTING_NetjailNode *node;
-  struct GNUNET_ShortHashCode *hkey;
-  struct GNUNET_HashCode hc;
-  struct GNUNET_TESTING_NetjailNamespace *namespace;
-  unsigned int namespace_n, node_m;
-
-  log_topo (topology);
-
-  hkey = GNUNET_new (struct GNUNET_ShortHashCode);
-  if (topology->nodes_x >= num)
-  {
-
-    GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
-    memcpy (hkey,
-            &hc,
-            sizeof (*hkey));
-    node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
-                                               hkey);
-  }
-  else
-  {
-    namespace_n = (unsigned int) floor ((num - topology->nodes_x)
-                                        / topology->nodes_m);
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
-         num,
-         topology->nodes_x,
-         topology->nodes_m,
-         namespace_n);
-    hkey = GNUNET_new (struct GNUNET_ShortHashCode);
-    GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
-    memcpy (hkey,
-            &hc,
-            sizeof (*hkey));
-    namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
-                                                    hkey);
-    node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
-    hkey = GNUNET_new (struct GNUNET_ShortHashCode);
-    GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
-    memcpy (hkey,
-            &hc,
-            sizeof (*hkey));
-    node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
-                                               hkey);
-  }
-
-
-  return node->node_connections_head;
-}
-
-
-static unsigned int
-calculate_num (struct GNUNET_TESTING_NodeConnection *node_connection,
-               struct GNUNET_TESTING_NetjailTopology *topology)
-{
-  unsigned int n, m, num;
-
-  n = node_connection->namespace_n;
-  m = node_connection->node_n;
-
-  if (0 == n)
-    num = m;
-  else
-    num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
-
-  return num;
-}
-
-static char *
-get_address (struct GNUNET_TESTING_NodeConnection *connection,
-             char *prefix)
-{
-  struct GNUNET_TESTING_NetjailNode *node;
-  char *addr;
-
-  node = connection->node;
-  if (connection->namespace_n == node->namespace_n)
-  {
-    if (0 == strcmp (PREFIX_TCP, prefix))
-    {
-
-      GNUNET_asprintf (&addr,
-                       CONNECT_ADDRESS_TEMPLATE_TCP,
-                       connection->node_n);
-    }
-    else if (0 == strcmp (PREFIX_UDP, prefix))
-    {
-      GNUNET_asprintf (&addr,
-                       CONNECT_ADDRESS_TEMPLATE_UDP,
-                       connection->node_n);
-    }
-    else
-    {
-      GNUNET_break (0);
-    }
-  }
-  else
-  {
-    if (0 == strcmp (PREFIX_TCP, prefix))
-    {
-
-      GNUNET_asprintf (&addr,
-                       ROUTER_CONNECT_ADDRESS_TEMPLATE_TCP,
-                       connection->namespace_n);
-    }
-    else if (0 == strcmp (PREFIX_UDP, prefix))
-    {
-      GNUNET_asprintf (&addr,
-                       ROUTER_CONNECT_ADDRESS_TEMPLATE_UDP,
-                       connection->namespace_n);
-    }
-    else
-    {
-      GNUNET_break (0);
-    }
-  }
-
-  return addr;
-}
-
-
 /**
  * The run method of this cmd will connect to peers.
  *
@@ -338,7 +106,7 @@ connect_peers_run (void *cls,
   enum GNUNET_NetworkType nt = 0;
   uint32_t num;
   struct GNUNET_TESTING_NodeConnection *pos_connection;
-  struct GNUNET_TESTING_ADDRESS_PREFIX *pos_prefix;
+  struct GNUNET_TESTING_AddressPrefix *pos_prefix;
   unsigned int con_num = 0;
 
   peer1_cmd = GNUNET_TESTING_interpreter_lookup_command 
(cps->start_peer_label);
@@ -351,13 +119,14 @@ connect_peers_run (void *cls,
 
   cps->tl_system = tl_system;
 
-  cps->node_connections_head = get_connections (cps->num, cps->topology);
+  cps->node_connections_head = GNUNET_TESTING_get_connections (cps->num,
+                                                               cps->topology);
 
   for (pos_connection = cps->node_connections_head; NULL != pos_connection;
        pos_connection = pos_connection->next)
   {
     con_num++;
-    num = calculate_num (pos_connection, cps->topology);
+    num = GNUNET_TESTING_calculate_num (pos_connection, cps->topology);
     for (pos_prefix = pos_connection->address_prefixes_head; NULL != 
pos_prefix;
          pos_prefix =
            pos_prefix->next)
@@ -367,9 +136,10 @@ connect_peers_run (void *cls,
            "prefix: %s\n",
            pos_prefix->address_prefix);
 
-      addr = get_address (pos_connection, pos_prefix->address_prefix);
+      addr = GNUNET_TESTING_get_address (pos_connection,
+                                         pos_prefix->address_prefix);
 
-      peer = get_pub_key (num, tl_system);
+      peer = GNUNET_TESTING_get_pub_key (num, tl_system);
 
       LOG (GNUNET_ERROR_TYPE_ERROR,
            "num: %u pub_key %s addr: %s\n",
@@ -417,8 +187,8 @@ connect_peers_finish (void *cls,
   for (pos_connection = cps->node_connections_head; NULL != pos_connection;
        pos_connection = pos_connection->next)
   {
-    num = calculate_num (pos_connection, cps->topology);
-    peer = get_pub_key (num, cps->tl_system);
+    num = GNUNET_TESTING_calculate_num (pos_connection, cps->topology);
+    peer = GNUNET_TESTING_get_pub_key (num, cps->tl_system);
     GNUNET_CRYPTO_hash (&(peer->public_key), sizeof(peer->public_key), &hc);
     memcpy (key,
             &hc,
@@ -476,6 +246,9 @@ connect_peers_cleanup (void *cls,
  *
  * @param label name for command.
  * @param start_peer_label Label of the cmd to start a peer.
+ * @param create_label Label of the cmd to create the testing system.
+ * @param num Number globally identifying the node.
+ * @param The topology for the test setup.
  * @return command.
  */
 struct GNUNET_TESTING_Command
diff --git a/src/transport/transport_api_cmd_send_simple_v3.c 
b/src/transport/transport_api_cmd_send_simple_v3.c
new file mode 100644
index 000000000..a4ce2c4e9
--- /dev/null
+++ b/src/transport/transport_api_cmd_send_simple_v3.c
@@ -0,0 +1,194 @@
+/*
+      This file is part of GNUnet
+      Copyright (C) 2021 GNUnet e.V.
+
+      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
+      Affero General Public License for more details.
+
+      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 testing_api_cmd_start_peer.c
+ * @brief cmd to start a peer.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+#include "transport-testing2.h"
+#include "transport-testing-cmds.h"
+
+/**
+ * Struct to hold information for callbacks.
+ *
+ */
+struct SendSimpleState
+{
+  /**
+   * Number globally identifying the node.
+   *
+   */
+  uint32_t num;
+
+  /**
+   * Label of the cmd to start a peer.
+   *
+   */
+  const char *start_peer_label;
+
+  /**
+   * Label of the cmd which started the test system.
+   *
+   */
+  const char *create_label;
+
+  /**
+   * The topology we get the connected nodes from.
+   */
+  struct GNUNET_TESTING_NetjailTopology *topology;
+};
+
+
+/**
+ * Trait function of this cmd does nothing.
+ *
+ */
+static int
+send_simple_traits (void *cls,
+                    const void **ret,
+                    const char *trait,
+                    unsigned int index)
+{
+  return GNUNET_OK;
+}
+
+
+/**
+ * The cleanup function of this cmd frees resources the cmd allocated.
+ *
+ */
+static void
+send_simple_cleanup (void *cls,
+                     const struct GNUNET_TESTING_Command *cmd)
+{
+  struct SendSimpleState *sss = cls;
+
+  GNUNET_free (sss);
+}
+
+
+/**
+ * The run method of this cmd will send a simple message to the connected 
peers.
+ *
+ */
+static void
+send_simple_run (void *cls,
+                 const struct GNUNET_TESTING_Command *cmd,
+                 struct GNUNET_TESTING_Interpreter *is)
+{
+  struct SendSimpleState *sss = cls;
+  struct GNUNET_MQ_Envelope *env;
+  struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
+  struct GNUNET_MQ_Handle *mq;
+  struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
+  const struct GNUNET_TESTING_Command *peer1_cmd;
+  struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode);
+  struct GNUNET_HashCode hc;
+  struct GNUNET_TESTING_NodeConnection *node_connections_head;
+  struct GNUNET_PeerIdentity *peer;
+  struct GNUNET_CRYPTO_EddsaPublicKey public_key;
+  uint32_t num;
+  struct GNUNET_TESTING_NodeConnection *pos_connection;
+  const struct GNUNET_TESTING_Command *system_cmd;
+  struct GNUNET_TESTING_System *tl_system;
+
+  peer1_cmd = GNUNET_TESTING_interpreter_lookup_command 
(sss->start_peer_label);
+  GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd,
+                                                  &connected_peers_map);
+
+  system_cmd = GNUNET_TESTING_interpreter_lookup_command (sss->create_label);
+  GNUNET_TESTING_get_trait_test_system (system_cmd,
+                                        &tl_system);
+
+  node_connections_head = GNUNET_TESTING_get_connections (sss->num,
+                                                          sss->topology);
+
+  for (int i = 0; i < 1; i++)
+  {
+    for (pos_connection = node_connections_head; NULL != pos_connection;
+         pos_connection = pos_connection->next)
+    {
+      num = GNUNET_TESTING_calculate_num (pos_connection, sss->topology);
+      peer = GNUNET_TESTING_get_pub_key (num, tl_system);
+      public_key = peer->public_key;
+      GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
+
+      memcpy (key,
+              &hc,
+              sizeof (*key));
+      mq = GNUNET_CONTAINER_multishortmap_get (connected_peers_map,
+                                               key);
+      env = GNUNET_MQ_msg_extra (test,
+                                 1000 - sizeof(*test),
+                                 GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE);
+      test->num = htonl (sss->num);
+      memset (&test[1],
+              sss->num,
+              1000 - sizeof(*test));
+      GNUNET_MQ_send (mq,
+                      env);
+    }
+  }
+
+  GNUNET_free (key);
+
+}
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @param start_peer_label Label of the cmd which started the test system.
+ * @param num Number globally identifying the node.
+ * @param The topology for the test setup.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TRANSPORT_cmd_send_simple_v3 (const char *label,
+                                     const char *start_peer_label,
+                                     const char *create_label,
+                                     uint32_t num,
+                                     struct GNUNET_TESTING_NetjailTopology *
+                                     topology)
+{
+  struct SendSimpleState *sss;
+
+  sss = GNUNET_new (struct SendSimpleState);
+  sss->num = num;
+  sss->start_peer_label = start_peer_label;
+  sss->create_label = create_label;
+  sss->topology = topology;
+
+  struct GNUNET_TESTING_Command cmd = {
+    .cls = sss,
+    .label = label,
+    .run = &send_simple_run,
+    .cleanup = &send_simple_cleanup,
+    .traits = &send_simple_traits
+  };
+
+  return cmd;
+}
diff --git a/src/util/helper.c b/src/util/helper.c
index dcb55d8c7..0809c1f17 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -407,6 +407,8 @@ start_helper (struct GNUNET_HELPER_Handle *h)
   if ((h->helper_in == NULL) || (h->helper_out == NULL))
   {
     /* out of file descriptors? try again later... */
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "out of file descriptors? try again later\n");
     stop_helper (h, GNUNET_NO);
     h->restart_task = GNUNET_SCHEDULER_add_delayed (
       GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
@@ -434,6 +436,8 @@ start_helper (struct GNUNET_HELPER_Handle *h)
   if (NULL == h->helper_proc)
   {
     /* failed to start process? try again later... */
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "failed to start process? try again later\n");
     stop_helper (h, GNUNET_NO);
     h->restart_task = GNUNET_SCHEDULER_add_delayed (
       GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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