aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet_single.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-23 14:41:52 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-23 14:41:52 +0100
commit098777821b554cacdfcdfc6b36e3708d6391bd9a (patch)
tree532aba631730e2194a1f4c97de44f1b4aeb68075 /src/cadet/test_cadet_single.c
parenta970ad152fbc76fe3b641c02840c5a58348efbd6 (diff)
downloadgnunet-098777821b554cacdfcdfc6b36e3708d6391bd9a.tar.gz
gnunet-098777821b554cacdfcdfc6b36e3708d6391bd9a.zip
avoid asserting in API on timeout destruction
Diffstat (limited to 'src/cadet/test_cadet_single.c')
-rw-r--r--src/cadet/test_cadet_single.c24
1 files 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;
49 49
50static unsigned int repetition; 50static unsigned int repetition;
51 51
52static struct GNUNET_CADET_TransmitHandle *nth;
53
52 54
53/* forward declaration */ 55/* forward declaration */
54static size_t 56static size_t
@@ -62,6 +64,11 @@ static void
62do_shutdown (void *cls) 64do_shutdown (void *cls)
63{ 65{
64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); 66 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
67 if (NULL != nth)
68 {
69 GNUNET_CADET_notify_transmit_ready_cancel (nth);
70 nth = NULL;
71 }
65 if (NULL != abort_task) 72 if (NULL != abort_task)
66 { 73 {
67 GNUNET_SCHEDULER_cancel (abort_task); 74 GNUNET_SCHEDULER_cancel (abort_task);
@@ -131,11 +138,11 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
131 my_channel = ch1; 138 my_channel = ch1;
132 else 139 else
133 my_channel = ch2; 140 my_channel = ch2;
134 GNUNET_CADET_notify_transmit_ready (my_channel, GNUNET_NO, 141 nth = GNUNET_CADET_notify_transmit_ready (my_channel, GNUNET_NO,
135 GNUNET_TIME_UNIT_FOREVER_REL, 142 GNUNET_TIME_UNIT_FOREVER_REL,
136 sizeof (struct GNUNET_MessageHeader) 143 sizeof (struct GNUNET_MessageHeader)
137 + DATA_SIZE, 144 + DATA_SIZE,
138 &do_send, NULL); 145 &do_send, NULL);
139 GNUNET_CADET_receive_done (channel); 146 GNUNET_CADET_receive_done (channel);
140 return GNUNET_OK; 147 return GNUNET_OK;
141 } 148 }
@@ -228,6 +235,7 @@ do_send (void *cls, size_t size, void *buf)
228{ 235{
229 struct GNUNET_MessageHeader *m = buf; 236 struct GNUNET_MessageHeader *m = buf;
230 237
238 nth = NULL;
231 if (NULL == buf) 239 if (NULL == buf)
232 { 240 {
233 GNUNET_break (0); 241 GNUNET_break (0);
@@ -257,9 +265,9 @@ do_connect (void *cls)
257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); 265 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n");
258 ch1 = GNUNET_CADET_channel_create (cadet, NULL, &id, GC_u2h (1), 266 ch1 = GNUNET_CADET_channel_create (cadet, NULL, &id, GC_u2h (1),
259 GNUNET_CADET_OPTION_DEFAULT); 267 GNUNET_CADET_OPTION_DEFAULT);
260 GNUNET_CADET_notify_transmit_ready (ch1, GNUNET_NO, 268 nth = GNUNET_CADET_notify_transmit_ready (ch1, GNUNET_NO,
261 GNUNET_TIME_UNIT_FOREVER_REL, 269 GNUNET_TIME_UNIT_FOREVER_REL,
262 size, &do_send, NULL); 270 size, &do_send, NULL);
263} 271}
264 272
265 273