-fix time assertion introduce in last patch
[oweals/gnunet.git] / src / util / test_mq_client.c
index 88e072c2b622a62f7d7e9e763204af228d691ec9..88113ffd01afd1b7534ae4a8b7be73aba4c8ea48 100644 (file)
@@ -23,7 +23,6 @@
  * @brief tests for mq with connection client
  */
 #include "platform.h"
-#include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 
 #define PORT 23336
@@ -49,13 +48,8 @@ recv_cb (void *cls, struct GNUNET_SERVER_Client *argclient,
          const struct GNUNET_MessageHeader *message)
 {
   received++;
-
-  printf ("received\n");
-
-
-  if ((received == 2) && (GNUNET_YES == notify))
+  if (received == 2)
   {
-    printf ("done\n");
     GNUNET_SERVER_receive_done (argclient, GNUNET_NO);
     return;
   }
@@ -99,15 +93,24 @@ static struct GNUNET_SERVER_MessageHandler handlers[] = {
   {NULL, NULL, 0, 0}
 };
 
-void send_cb (void *cls)
+
+static void
+send_cb (void *cls)
 {
   /* the notify should only be called once */
   GNUNET_assert (GNUNET_NO == notify);
-  printf ("notify sent\n");
   notify = GNUNET_YES;
 }
 
-void test_mq (struct GNUNET_CLIENT_Connection *client)
+static void
+send_trap_cb (void *cls)
+{
+  GNUNET_abort ();
+}
+
+
+static void
+test_mq (struct GNUNET_CLIENT_Connection *client)
 {
   struct GNUNET_MQ_Handle *mq;
   struct GNUNET_MQ_Envelope *mqm;
@@ -118,11 +121,15 @@ void test_mq (struct GNUNET_CLIENT_Connection *client)
   mqm = GNUNET_MQ_msg_header (MY_TYPE);
   GNUNET_MQ_send (mq, mqm);
 
+  mqm = GNUNET_MQ_msg_header (MY_TYPE);
+  GNUNET_MQ_notify_sent (mqm, send_trap_cb, NULL);
+  GNUNET_MQ_send (mq, mqm);
+  GNUNET_MQ_send_cancel (mqm);
+
   mqm = GNUNET_MQ_msg_header (MY_TYPE);
   GNUNET_MQ_notify_sent (mqm, send_cb, NULL);
   GNUNET_MQ_send (mq, mqm);
 
-  /* FIXME: add a message that will be canceled */
 }
 
 
@@ -171,6 +178,7 @@ main (int argc, char *argv[])
                     NULL);
   ok = 1;
   GNUNET_SCHEDULER_run (&task, NULL);
+  GNUNET_assert (GNUNET_YES == notify);
   return ok;
 }