close port at testbed disconnect
authorxrs <xrs@mail36.net>
Fri, 20 Mar 2020 13:56:21 +0000 (14:56 +0100)
committerxrs <xrs@mail36.net>
Thu, 21 May 2020 20:46:49 +0000 (22:46 +0200)
src/cadet/test_cadeT.c
src/cadet/test_cadeT_util.c

index 3bf8e2ad94c867435041fb86cead91922ffa4683..5e92084a6f7def2e70da1a2d6dfa78b508d2c6e8 100644 (file)
@@ -45,6 +45,7 @@
  *     - GNUNET_TESTBED_underlay_configure_link not implemented
  *     - GNUNET_TESTBED_underlaylinkmodel_set_link not usable
  *     - GNUNET_TESTBED_peer_stop evokes standard service disconnect
+ *     - GNUNET_TESTBED_peer_destroy and GNUNET_TESTBED_peer_create
  *   - how can we test the sublayers of CADET, e.g. connection, tunnel, channel?
  *
  * Development
index f2082a00679febd421d9e42e4de2b3ce98ae824b..bc66adbdc1baade00f9d113ebd9bea99e5c2883c 100644 (file)
@@ -40,6 +40,11 @@ static struct GNUNET_TESTBED_Operation *testbed_info_req[REQUESTED_PEERS];
  */
 static struct GNUNET_HashCode hashed_portname;
 
+/**
+ * Port handle.
+ */
+struct GNUNET_CADET_Port *port;
+
 /**
  * Result of the test.
  */
@@ -78,6 +83,9 @@ disconnect_from_peer (void *cls,
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
 
+  if (0 == strncmp ("listening_peer", cls, sizeof (cls)))
+    GNUNET_CADET_close_port (port);
+
   GNUNET_CADET_disconnect (cadet);
 }
 
@@ -134,7 +142,6 @@ setup_listening_peer (void *cls,
                       const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_CADET_Handle *cadet;
-  struct GNUNET_CADET_Port *port;
   struct GNUNET_MQ_MessageHandler msg_handlers[] = {
     GNUNET_MQ_hd_fixed_size (message,
                              GNUNET_MESSAGE_TYPE_DUMMY,
@@ -198,13 +205,13 @@ connect_to_service (void *cb_cls,
                                       "cadet", 
                                       &check_test_readyness, NULL,
                                       &setup_listening_peer,
-                                      &disconnect_from_peer, NULL);
+                                      &disconnect_from_peer, "listening_peer");
     testbed_to_svc[0] = 
       GNUNET_TESTBED_service_connect (NULL, test_peers[0].testbed_peer,
                                       "cadet",
                                       &check_test_readyness, NULL,
                                       &setup_initiating_peer,
-                                      &disconnect_from_peer, NULL);
+                                      &disconnect_from_peer, "initiating_peer");
   }
 }