gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 13/14: avoid asserting in API on timeout destructi


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 13/14: avoid asserting in API on timeout destruction
Date: Mon, 23 Jan 2017 14:42:53 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 098777821b554cacdfcdfc6b36e3708d6391bd9a
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Jan 23 14:41:52 2017 +0100

    avoid asserting in API on timeout destruction
---
 src/cadet/test_cadet_single.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/cadet/test_cadet_single.c b/src/cadet/test_cadet_single.c
index d9aa1a214..a2716127d 100644
--- a/src/cadet/test_cadet_single.c
+++ b/src/cadet/test_cadet_single.c
@@ -49,6 +49,8 @@ static struct GNUNET_SCHEDULER_Task *connect_task;
 
 static unsigned int repetition;
 
+static struct GNUNET_CADET_TransmitHandle *nth;
+
 
 /* forward declaration */
 static size_t
@@ -62,6 +64,11 @@ static void
 do_shutdown (void *cls)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
+  if (NULL != nth)
+  {
+    GNUNET_CADET_notify_transmit_ready_cancel (nth);
+    nth = NULL;
+  }
   if (NULL != abort_task)
   {
     GNUNET_SCHEDULER_cancel (abort_task);
@@ -131,11 +138,11 @@ data_callback (void *cls, struct GNUNET_CADET_Channel 
*channel,
       my_channel = ch1;
     else
       my_channel = ch2;
-    GNUNET_CADET_notify_transmit_ready (my_channel, GNUNET_NO,
-                                       GNUNET_TIME_UNIT_FOREVER_REL,
-                                       sizeof (struct GNUNET_MessageHeader)
-                                       + DATA_SIZE,
-                                       &do_send, NULL);
+    nth = GNUNET_CADET_notify_transmit_ready (my_channel, GNUNET_NO,
+                                              GNUNET_TIME_UNIT_FOREVER_REL,
+                                              sizeof (struct 
GNUNET_MessageHeader)
+                                              + DATA_SIZE,
+                                              &do_send, NULL);
     GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
   }
@@ -228,6 +235,7 @@ do_send (void *cls, size_t size, void *buf)
 {
   struct GNUNET_MessageHeader *m = buf;
 
+  nth = NULL;
   if (NULL == buf)
   {
     GNUNET_break (0);
@@ -257,9 +265,9 @@ do_connect (void *cls)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n");
   ch1 = GNUNET_CADET_channel_create (cadet, NULL, &id, GC_u2h (1),
                                      GNUNET_CADET_OPTION_DEFAULT);
-  GNUNET_CADET_notify_transmit_ready (ch1, GNUNET_NO,
-                                     GNUNET_TIME_UNIT_FOREVER_REL,
-                                     size, &do_send, NULL);
+  nth = GNUNET_CADET_notify_transmit_ready (ch1, GNUNET_NO,
+                                            GNUNET_TIME_UNIT_FOREVER_REL,
+                                            size, &do_send, NULL);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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