handle received message; fix format; fix testbed ops
authorxrs <xrs@mail36.net>
Thu, 19 Mar 2020 20:03:42 +0000 (21:03 +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
src/cadet/test_cadeT_util.h

index c939976b26cdb9067d0162591ce8e05e45cae36e..3bf8e2ad94c867435041fb86cead91922ffa4683 100644 (file)
@@ -31,8 +31,8 @@
  *   x setup cadet on peer B listening on port "cadet_port"
  *   x create a channel from peer A to B
  *   x create method to find out KX initiator
- *   - send a message over channel
- *   - check if message was received
+ *   x send a message over channel
+ *   x check if message was received
  *   - breakup the connection without the receiver receiving a channel destroy message
  *   - assert tunnel is down
  *   - resume channel (second handshake for tunnel)
@@ -42,7 +42,9 @@
  *
  * Questions:
  *   - can we simulate hard breakups with TESTBED?
- *     - yes, with GNUNET_TESTBED_underlay_configure_link 
+ *     - GNUNET_TESTBED_underlay_configure_link not implemented
+ *     - GNUNET_TESTBED_underlaylinkmodel_set_link not usable
+ *     - GNUNET_TESTBED_peer_stop evokes standard service disconnect
  *   - how can we test the sublayers of CADET, e.g. connection, tunnel, channel?
  *
  * Development
@@ -61,8 +63,9 @@
 
 static int kx_initiator;
 
-void
-handle_message ()
+void 
+handle_message (void *cls, 
+                const struct GNUNET_MessageHeader *msg)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
 }
@@ -75,9 +78,11 @@ send_message ()
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
 
-  envelope = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_DUMMY);
+  envelope = GNUNET_MQ_msg (msg, 
+                            GNUNET_MESSAGE_TYPE_DUMMY);
 
-  GNUNET_MQ_send (GNUNET_CADET_get_mq (test_peers[0].channel), envelope);
+  GNUNET_MQ_send (GNUNET_CADET_get_mq (test_peers[0].channel), 
+                  envelope);
 }
 
 /**
index e983dab12a9f0f12d6b52e80e53a3930f5c5aa29..f2082a00679febd421d9e42e4de2b3ce98ae824b 100644 (file)
@@ -58,7 +58,10 @@ shutdown_task (void *cls)
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
 
   for (int i=0; i<REQUESTED_PEERS; i++)
+  {
     GNUNET_TESTBED_operation_done (testbed_to_svc[i]);
+    GNUNET_TESTBED_operation_done (testbed_info_req[i]);
+  }
 }
 
 static void
@@ -91,13 +94,6 @@ setup_initiating_peer (void *cls,
 {
   struct GNUNET_CADET_Handle *cadet;
   struct GNUNET_CADET_Channel *channel;
-  struct GNUNET_MQ_MessageHandler msg_handlers[] = {
-    GNUNET_MQ_hd_fixed_size (message,
-                             GNUNET_MESSAGE_TYPE_DUMMY,
-                             struct GNUNET_MessageHeader,
-                             NULL),
-    GNUNET_MQ_handler_end ()
-  };
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
 
@@ -113,7 +109,7 @@ setup_initiating_peer (void *cls,
                                          &hashed_portname,
                                          NULL,
                                          &disconnect_channel,
-                                         msg_handlers);
+                                         NULL);
   test_peers[0].channel = channel;
 
   return cadet;
@@ -184,7 +180,7 @@ peerinfo_complete ()
   return (REQUESTED_PEERS == ++peerinfo_cnt) ? GNUNET_YES : GNUNET_NO;
 }
 
-void
+static void
 connect_to_service (void *cb_cls,
                     struct GNUNET_TESTBED_Operation *op,
                     const struct GNUNET_TESTBED_PeerInformation *pinfo,
index de1a24a26da473e9d8f51354ca4c98a69639d0b2..1c85abab6ea64dadd49adc5d9d2a7924bc819b76 100644 (file)
@@ -37,7 +37,8 @@ void prepare_test ();
 
 void run_test ();
 
-void handle_message ();
+void handle_message (void *cls,
+                     const struct GNUNET_MessageHeader *msg);
 
 /**
  * Structure for storing information of testbed peers.