gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37566 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r37566 - gnunet/src/transport
Date: Sat, 23 Jul 2016 00:11:56 +0200

Author: grothoff
Date: 2016-07-23 00:11:56 +0200 (Sat, 23 Jul 2016)
New Revision: 37566

Modified:
   gnunet/src/transport/test_transport_api_blacklisting.c
Log:
migrate more tests to new transmission API

Modified: gnunet/src/transport/test_transport_api_blacklisting.c
===================================================================
--- gnunet/src/transport/test_transport_api_blacklisting.c      2016-07-22 
22:07:51 UTC (rev 37565)
+++ gnunet/src/transport/test_transport_api_blacklisting.c      2016-07-22 
22:11:56 UTC (rev 37566)
@@ -117,46 +117,13 @@
 {
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               "Unexpectedly even received the message despite blacklist\n");
-  GNUNET_SCHEDULER_shutdown ();
+  connected = GNUNET_YES;
+  GNUNET_SCHEDULER_cancel (shutdown_task);
+  end (NULL);
 }
 
 
-static size_t
-notify_ready (void *cls,
-              size_t size,
-              void *buf)
-{
-  struct GNUNET_MessageHeader *hdr;
-
-  th = NULL;
-  if (NULL == buf)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Timeout occurred while waiting for transmit_ready\n");
-    GNUNET_SCHEDULER_shutdown ();
-    return 0;
-  }
-  GNUNET_assert (size >= TEST_MESSAGE_SIZE);
-  hdr = buf;
-  hdr->size = htons (TEST_MESSAGE_SIZE);
-  hdr->type = htons (TEST_MESSAGE_TYPE);
-  return TEST_MESSAGE_SIZE;
-}
-
-
 static void
-sendtask (void *cls)
-{
-  th = GNUNET_TRANSPORT_notify_transmit_ready (ccc->p[1]->th,
-                                               &ccc->p[0]->id,
-                                               TEST_MESSAGE_SIZE,
-                                               TIMEOUT,
-                                               &notify_ready,
-                                               ccc->p[0]);
-}
-
-
-static void
 notify_connect (void *cls,
                 struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
                 const struct GNUNET_PeerIdentity *other)
@@ -172,22 +139,6 @@
 }
 
 
-static void
-notify_disconnect (void *cls,
-                   struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                   const struct GNUNET_PeerIdentity *other)
-{
-  GNUNET_TRANSPORT_TESTING_log_disconnect (cls,
-                                           me,
-                                           other);
-  if (NULL != th)
-  {
-    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
-    th = NULL;
-  }
-}
-
-
 static int
 blacklist_cb (void *cls,
               const struct GNUNET_PeerIdentity *pid)
@@ -244,13 +195,17 @@
 main (int argc,
       char *argv[])
 {
+  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
+    .num_messages = 1
+  };
   struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
     .pre_connect_task = &start_blacklist,
-    .connect_continuation = &sendtask,
+    .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
+    .connect_continuation_cls = &sc,
     .config_file = "test_transport_api_data.conf",
     .rec = &notify_receive,
     .nc = &notify_connect,
-    .nd = &notify_disconnect,
+    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
     .shutdown_task = &custom_shutdown,
     .timeout = TIMEOUT,
     .bi_directional = GNUNET_YES




reply via email to

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