aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-12-12 16:25:18 +0000
committerBart Polot <bart@net.in.tum.de>2013-12-12 16:25:18 +0000
commit58cda642bdd13b46cb85b109a9d54f9c37dceebd (patch)
tree0df82e5210fbd2b027b1c62880f199ede135c95c /src
parentaf5c03fe7c21923249f5cb287cd2e4dca1243004 (diff)
downloadgnunet-58cda642bdd13b46cb85b109a9d54f9c37dceebd.tar.gz
gnunet-58cda642bdd13b46cb85b109a9d54f9c37dceebd.zip
- simplify tunnel delayed queue
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh_channel.c91
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.c75
2 files changed, 82 insertions, 84 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
index ad2d4a0ee..bf1a127c5 100644
--- a/src/mesh/gnunet-service-mesh_channel.c
+++ b/src/mesh/gnunet-service-mesh_channel.c
@@ -69,7 +69,7 @@ struct MeshChannelQueue
69 /** 69 /**
70 * Tunnel Queue. 70 * Tunnel Queue.
71 */ 71 */
72 struct MeshTunnel3Queue *q; 72 struct MeshTunnel3Queue *tq;
73 73
74 /** 74 /**
75 * Message type (DATA/DATA_ACK) 75 * Message type (DATA/DATA_ACK)
@@ -117,7 +117,7 @@ struct MeshReliableMessage
117 /** 117 /**
118 * Tunnel Queue. 118 * Tunnel Queue.
119 */ 119 */
120 struct MeshChannelQueue *q; 120 struct MeshChannelQueue *chq;
121 121
122 /** 122 /**
123 * When was this message issued (to calculate ACK delay) 123 * When was this message issued (to calculate ACK delay)
@@ -728,15 +728,15 @@ ch_message_sent (void *cls,
728 struct MeshTunnel3Queue *q, 728 struct MeshTunnel3Queue *q,
729 uint16_t type, size_t size) 729 uint16_t type, size_t size)
730{ 730{
731 struct MeshChannelQueue *ch_q = cls; 731 struct MeshChannelQueue *chq = cls;
732 struct MeshReliableMessage *copy = ch_q->copy; 732 struct MeshReliableMessage *copy = chq->copy;
733 struct MeshChannelReliability *rel; 733 struct MeshChannelReliability *rel;
734 734
735 switch (ch_q->type) 735 switch (chq->type)
736 { 736 {
737 case GNUNET_MESSAGE_TYPE_MESH_DATA: 737 case GNUNET_MESSAGE_TYPE_MESH_DATA:
738 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid); 738 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid);
739 GNUNET_assert (ch_q == copy->q); 739 GNUNET_assert (chq == copy->chq);
740 copy->timestamp = GNUNET_TIME_absolute_get (); 740 copy->timestamp = GNUNET_TIME_absolute_get ();
741 rel = copy->rel; 741 rel = copy->rel;
742 if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task) 742 if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task)
@@ -767,16 +767,16 @@ ch_message_sent (void *cls,
767 { 767 {
768 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! retry task %u\n", rel->retry_task); 768 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! retry task %u\n", rel->retry_task);
769 } 769 }
770 copy->q = NULL; 770 copy->chq = NULL;
771 break; 771 break;
772 772
773 773
774 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 774 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
775 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 775 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
776 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 776 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
777 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (ch_q->type)); 777 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type));
778 rel = ch_q->rel; 778 rel = chq->rel;
779 GNUNET_assert (rel->uniq == ch_q); 779 GNUNET_assert (rel->uniq == chq);
780 rel->uniq = NULL; 780 rel->uniq = NULL;
781 781
782 if (MESH_CHANNEL_READY != rel->ch->state 782 if (MESH_CHANNEL_READY != rel->ch->state
@@ -797,7 +797,7 @@ ch_message_sent (void *cls,
797 GNUNET_break (0); 797 GNUNET_break (0);
798 } 798 }
799 799
800 GNUNET_free (ch_q); 800 GNUNET_free (chq);
801} 801}
802 802
803 803
@@ -935,7 +935,7 @@ channel_rel_free_all (struct MeshChannelReliability *rel)
935 next = copy->next; 935 next = copy->next;
936 GNUNET_CONTAINER_DLL_remove (rel->head_recv, rel->tail_recv, copy); 936 GNUNET_CONTAINER_DLL_remove (rel->head_recv, rel->tail_recv, copy);
937 LOG (GNUNET_ERROR_TYPE_DEBUG, " COPYFREE BATCH RECV %p\n", copy); 937 LOG (GNUNET_ERROR_TYPE_DEBUG, " COPYFREE BATCH RECV %p\n", copy);
938 GNUNET_break (NULL == copy->q); 938 GNUNET_break (NULL == copy->chq);
939 GNUNET_free (copy); 939 GNUNET_free (copy);
940 } 940 }
941 for (copy = rel->head_sent; NULL != copy; copy = next) 941 for (copy = rel->head_sent; NULL != copy; copy = next)
@@ -943,24 +943,24 @@ channel_rel_free_all (struct MeshChannelReliability *rel)
943 next = copy->next; 943 next = copy->next;
944 GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy); 944 GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy);
945 LOG (GNUNET_ERROR_TYPE_DEBUG, " COPYFREE BATCH %p\n", copy); 945 LOG (GNUNET_ERROR_TYPE_DEBUG, " COPYFREE BATCH %p\n", copy);
946 if (NULL != copy->q) 946 if (NULL != copy->chq)
947 { 947 {
948 if (NULL != copy->q->q) 948 if (NULL != copy->chq->tq)
949 { 949 {
950 GMT_cancel (copy->q->q); 950 GMT_cancel (copy->chq->tq);
951 /* ch_message_sent will free copy->q */ 951 /* ch_message_sent will free copy->q */
952 } 952 }
953 else 953 else
954 { 954 {
955 GNUNET_free (copy->q); 955 GNUNET_free (copy->chq);
956 GNUNET_break (0); 956 GNUNET_break (0);
957 } 957 }
958 } 958 }
959 GNUNET_free (copy); 959 GNUNET_free (copy);
960 } 960 }
961 if (NULL != rel->uniq && NULL != rel->uniq->q) 961 if (NULL != rel->uniq && NULL != rel->uniq->tq)
962 { 962 {
963 GMT_cancel (rel->uniq->q); 963 GMT_cancel (rel->uniq->tq);
964 /* ch_message_sent is called freeing uniq */ 964 /* ch_message_sent is called freeing uniq */
965 } 965 }
966 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) 966 if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task)
@@ -1088,9 +1088,9 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time)
1088 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n"); 1088 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n");
1089 } 1089 }
1090 rel->ch->pending_messages--; 1090 rel->ch->pending_messages--;
1091 if (NULL != copy->q) 1091 if (NULL != copy->chq)
1092 { 1092 {
1093 GMT_cancel (copy->q->q); 1093 GMT_cancel (copy->chq->tq);
1094 /* copy->q is set to NULL by ch_message_sent */ 1094 /* copy->q is set to NULL by ch_message_sent */
1095 } 1095 }
1096 GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy); 1096 GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy);
@@ -1147,7 +1147,7 @@ channel_confirm (struct MeshChannel *ch, int fwd)
1147 } 1147 }
1148 else if (NULL != rel->uniq) 1148 else if (NULL != rel->uniq)
1149 { 1149 {
1150 GMT_cancel (rel->uniq->q); 1150 GMT_cancel (rel->uniq->tq);
1151 /* ch_message_sent will free and NULL uniq */ 1151 /* ch_message_sent will free and NULL uniq */
1152 } 1152 }
1153 else 1153 else
@@ -2021,7 +2021,7 @@ GMCH_handle_data_ack (struct MeshChannel *ch,
2021 { 2021 {
2022 GNUNET_SCHEDULER_cancel (rel->retry_task); 2022 GNUNET_SCHEDULER_cancel (rel->retry_task);
2023 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 2023 rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
2024 if (NULL != rel->head_sent && NULL == rel->head_sent->q) 2024 if (NULL != rel->head_sent && NULL == rel->head_sent->chq)
2025 { 2025 {
2026 struct GNUNET_TIME_Absolute new_target; 2026 struct GNUNET_TIME_Absolute new_target;
2027 struct GNUNET_TIME_Relative delay; 2027 struct GNUNET_TIME_Relative delay;
@@ -2233,7 +2233,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2233 struct MeshChannel *ch, int fwd, 2233 struct MeshChannel *ch, int fwd,
2234 void *existing_copy) 2234 void *existing_copy)
2235{ 2235{
2236 struct MeshChannelQueue *q; 2236 struct MeshChannelQueue *chq;
2237 uint16_t type; 2237 uint16_t type;
2238 2238
2239 type = ntohs (message->type); 2239 type = ntohs (message->type);
@@ -2253,14 +2253,14 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2253 2253
2254 if (GNUNET_YES == ch->reliable) 2254 if (GNUNET_YES == ch->reliable)
2255 { 2255 {
2256 q = GNUNET_new (struct MeshChannelQueue); 2256 chq = GNUNET_new (struct MeshChannelQueue);
2257 q->type = type; 2257 chq->type = type;
2258 if (NULL == existing_copy) 2258 if (NULL == existing_copy)
2259 q->copy = channel_save_copy (ch, message, fwd); 2259 chq->copy = channel_save_copy (ch, message, fwd);
2260 else 2260 else
2261 { 2261 {
2262 q->copy = (struct MeshReliableMessage *) existing_copy; 2262 chq->copy = (struct MeshReliableMessage *) existing_copy;
2263 if (NULL != q->copy->q) 2263 if (NULL != chq->copy->chq)
2264 { 2264 {
2265 /* Last retransmission was queued but not yet sent! 2265 /* Last retransmission was queued but not yet sent!
2266 * This retransmission was scheduled by a ch_message_sent which 2266 * This retransmission was scheduled by a ch_message_sent which
@@ -2271,7 +2271,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2271 * retransmission leaves the peer and ch_message_sent starts 2271 * retransmission leaves the peer and ch_message_sent starts
2272 * the timer for the next one. 2272 * the timer for the next one.
2273 */ 2273 */
2274 GNUNET_free (q); 2274 GNUNET_free (chq);
2275 LOG (GNUNET_ERROR_TYPE_DEBUG, 2275 LOG (GNUNET_ERROR_TYPE_DEBUG,
2276 " exisitng copy not yet transmitted!\n"); 2276 " exisitng copy not yet transmitted!\n");
2277 return; 2277 return;
@@ -2279,15 +2279,15 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2279 LOG (GNUNET_ERROR_TYPE_DEBUG, 2279 LOG (GNUNET_ERROR_TYPE_DEBUG,
2280 " using existing copy: %p {r:%p q:%p t:%u}\n", 2280 " using existing copy: %p {r:%p q:%p t:%u}\n",
2281 existing_copy, 2281 existing_copy,
2282 q->copy->rel, q->copy->q, q->copy->type); 2282 chq->copy->rel, chq->copy->chq, chq->copy->type);
2283 } 2283 }
2284 LOG (GNUNET_ERROR_TYPE_DEBUG, " new q: %p\n", q); 2284 LOG (GNUNET_ERROR_TYPE_DEBUG, " new chq: %p\n", chq);
2285 q->copy->q = q; 2285 chq->copy->chq = chq;
2286 q->q = GMT_send_prebuilt_message (message, ch->t, 2286 chq->tq = GMT_send_prebuilt_message (message, ch->t,
2287 NULL != existing_copy, 2287 NULL != existing_copy,
2288 &ch_message_sent, q); 2288 &ch_message_sent, chq);
2289 /* q itself is stored in copy */ 2289 /* q itself is stored in copy */
2290 GNUNET_assert (NULL != q->q || GNUNET_NO != ch->destroy); 2290 GNUNET_assert (NULL != chq->tq || GNUNET_NO != ch->destroy);
2291 } 2291 }
2292 else 2292 else
2293 { 2293 {
@@ -2306,24 +2306,25 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2306 /* fall-trough */ 2306 /* fall-trough */
2307 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 2307 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
2308 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 2308 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
2309 q = GNUNET_new (struct MeshChannelQueue); 2309 chq = GNUNET_new (struct MeshChannelQueue);
2310 q->type = type; 2310 chq->type = type;
2311 q->rel = fwd ? ch->root_rel : ch->dest_rel; 2311 chq->rel = fwd ? ch->root_rel : ch->dest_rel;
2312 if (NULL != q->rel->uniq) 2312 if (NULL != chq->rel->uniq)
2313 { 2313 {
2314 if (NULL != q->rel->uniq->q) 2314 if (NULL != chq->rel->uniq->tq)
2315 { 2315 {
2316 GMT_cancel (q->rel->uniq->q); 2316 GMT_cancel (chq->rel->uniq->tq);
2317 /* ch_message_sent is called, freeing and NULLing uniq */ 2317 /* ch_message_sent is called, freeing and NULLing uniq */
2318 } 2318 }
2319 else 2319 else
2320 { 2320 {
2321 GNUNET_free (q->rel->uniq); 2321 GNUNET_break (0);
2322 GNUNET_free (chq->rel->uniq);
2322 } 2323 }
2323 } 2324 }
2324 q->q = GMT_send_prebuilt_message (message, ch->t, GNUNET_YES, 2325 chq->tq = GMT_send_prebuilt_message (message, ch->t, GNUNET_YES,
2325 &ch_message_sent, q); 2326 &ch_message_sent, chq);
2326 q->rel->uniq = q; 2327 chq->rel->uniq = chq;
2327 break; 2328 break;
2328 2329
2329 2330
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c
index 60df54f18..1fb37bcd3 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.c
+++ b/src/mesh/gnunet-service-mesh_tunnel.c
@@ -162,9 +162,10 @@ struct MeshTunnelDelayed
162 */ 162 */
163 struct MeshTunnel3 *t; 163 struct MeshTunnel3 *t;
164 164
165 struct MeshTunnel3Queue *q; 165 /**
166 GMT_sent cont; 166 * Tunnel queue given to the channel to cancel request. Update on send_queued.
167 void *cont_cls; 167 */
168 struct MeshTunnel3Queue *tq;
168 169
169 /** 170 /**
170 * Message to send. 171 * Message to send.
@@ -181,12 +182,12 @@ struct MeshTunnel3Queue
181 /** 182 /**
182 * Connection queue handle, to cancel if necessary. 183 * Connection queue handle, to cancel if necessary.
183 */ 184 */
184 struct MeshConnectionQueue *q; 185 struct MeshConnectionQueue *cq;
185 186
186 /** 187 /**
187 * Handle in case message hasn't been given to a connection yet. 188 * Handle in case message hasn't been given to a connection yet.
188 */ 189 */
189 struct MeshTunnelDelayed *tq; 190 struct MeshTunnelDelayed *tqd;
190 191
191 /** 192 /**
192 * Continuation to call once sent. 193 * Continuation to call once sent.
@@ -653,8 +654,7 @@ unqueue_data (struct MeshTunnelDelayed *tq)
653 * @param msg Message itself (copy will be made). 654 * @param msg Message itself (copy will be made).
654 */ 655 */
655static struct MeshTunnelDelayed * 656static struct MeshTunnelDelayed *
656queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg, 657queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg)
657 GMT_sent cont, void *cont_cls)
658{ 658{
659 struct MeshTunnelDelayed *tq; 659 struct MeshTunnelDelayed *tq;
660 uint16_t size = ntohs (msg->size); 660 uint16_t size = ntohs (msg->size);
@@ -670,8 +670,6 @@ queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg,
670 tq = GNUNET_malloc (sizeof (struct MeshTunnelDelayed) + size); 670 tq = GNUNET_malloc (sizeof (struct MeshTunnelDelayed) + size);
671 671
672 tq->t = t; 672 tq->t = t;
673 tq->cont = cont;
674 tq->cont_cls = cont_cls;
675 memcpy (&tq[1], msg, size); 673 memcpy (&tq[1], msg, size);
676 GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq); 674 GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq);
677 return tq; 675 return tq;
@@ -700,11 +698,10 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
700 GMT_sent cont, void *cont_cls, 698 GMT_sent cont, void *cont_cls,
701 struct MeshTunnel3Queue *existing_q) 699 struct MeshTunnel3Queue *existing_q)
702{ 700{
703 struct MeshTunnel3Queue *q; 701 struct MeshTunnel3Queue *tq;
704 struct MeshConnection *c; 702 struct MeshConnection *c;
705 struct GNUNET_MESH_Encrypted *msg; 703 struct GNUNET_MESH_Encrypted *msg;
706 size_t size = ntohs (message->size); 704 size_t size = ntohs (message->size);
707 size_t encrypted_size;
708 char cbuf[sizeof (struct GNUNET_MESH_Encrypted) + size]; 705 char cbuf[sizeof (struct GNUNET_MESH_Encrypted) + size];
709 uint32_t iv; 706 uint32_t iv;
710 uint16_t type; 707 uint16_t type;
@@ -715,10 +712,12 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
715 if (GNUNET_NO == is_ready (t)) 712 if (GNUNET_NO == is_ready (t))
716 { 713 {
717 GNUNET_assert (NULL == existing_q); 714 GNUNET_assert (NULL == existing_q);
718 q = GNUNET_new (struct MeshTunnel3Queue); 715 tq = GNUNET_new (struct MeshTunnel3Queue);
719 q->tq = queue_data (t, message, cont, cont_cls); 716 tq->tqd = queue_data (t, message);
720 q->tq->q = q; 717 tq->tqd->tq = tq;
721 return q; 718 tq->cont = cont;
719 tq->cont_cls = cont_cls;
720 return tq;
722 } 721 }
723 722
724 GNUNET_assert (GNUNET_NO == GMT_is_loopback (t)); 723 GNUNET_assert (GNUNET_NO == GMT_is_loopback (t));
@@ -727,9 +726,8 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
727 msg = (struct GNUNET_MESH_Encrypted *) cbuf; 726 msg = (struct GNUNET_MESH_Encrypted *) cbuf;
728 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED); 727 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED);
729 msg->iv = iv; 728 msg->iv = iv;
730 encrypted_size = t_encrypt (t, &msg[1], message, size, iv); 729 GNUNET_assert (t_encrypt (t, &msg[1], message, size, iv) == size);
731 msg->header.size = htons (sizeof (struct GNUNET_MESH_Encrypted) 730 msg->header.size = htons (sizeof (struct GNUNET_MESH_Encrypted) + size);
732 + encrypted_size);
733 c = tunnel_get_connection (t); 731 c = tunnel_get_connection (t);
734 if (NULL == c) 732 if (NULL == c)
735 { 733 {
@@ -762,19 +760,19 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
762 } 760 }
763 if (NULL == existing_q) 761 if (NULL == existing_q)
764 { 762 {
765 q = GNUNET_new (struct MeshTunnel3Queue); /* FIXME valgrind: leak*/ 763 tq = GNUNET_new (struct MeshTunnel3Queue); /* FIXME valgrind: leak*/
766 } 764 }
767 else 765 else
768 { 766 {
769 q = existing_q; 767 tq = existing_q;
770 q->tq = NULL; 768 tq->tqd = NULL;
771 } 769 }
772 q->q = GMC_send_prebuilt_message (&msg->header, c, fwd, force, 770 tq->cq = GMC_send_prebuilt_message (&msg->header, c, fwd, force,
773 &message_sent, q); 771 &message_sent, tq);
774 q->cont = cont; 772 tq->cont = cont;
775 q->cont_cls = cont_cls; 773 tq->cont_cls = cont_cls;
776 774
777 return q; 775 return tq;
778} 776}
779 777
780 778
@@ -786,7 +784,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
786static void 784static void
787send_queued_data (struct MeshTunnel3 *t) 785send_queued_data (struct MeshTunnel3 *t)
788{ 786{
789 struct MeshTunnelDelayed *tq; 787 struct MeshTunnelDelayed *tqd;
790 struct MeshTunnelDelayed *next; 788 struct MeshTunnelDelayed *next;
791 unsigned int room; 789 unsigned int room;
792 790
@@ -810,18 +808,17 @@ send_queued_data (struct MeshTunnel3 *t)
810 room = GMT_get_connections_buffer (t); 808 room = GMT_get_connections_buffer (t);
811 LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room); 809 LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room);
812 LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head); 810 LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head);
813 for (tq = t->tq_head; NULL != tq && room > 0; tq = next) 811 for (tqd = t->tq_head; NULL != tqd && room > 0; tqd = next)
814 { 812 {
815 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending queued data\n"); 813 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending queued data\n");
816 next = tq->next; 814 next = tqd->next;
817 room--; 815 room--;
818 send_prebuilt_message ((struct GNUNET_MessageHeader *) &tq[1], 816 send_prebuilt_message ((struct GNUNET_MessageHeader *) &tqd[1],
819 tq->t, GNUNET_YES, tq->cont, tq->cont_cls, tq->q); 817 tqd->t, GNUNET_YES,
820 unqueue_data (tq); 818 tqd->tq->cont, tqd->tq->cont_cls, tqd->tq);
819 unqueue_data (tqd);
821 } 820 }
822 LOG (GNUNET_ERROR_TYPE_DEBUG, 821 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_send_queued_data end\n", GMP_2s (t->peer));
823 "GMT_send_queued_data end\n",
824 GMP_2s (t->peer));
825} 822}
826 823
827 824
@@ -2274,14 +2271,14 @@ GMT_send_connection_acks (struct MeshTunnel3 *t)
2274void 2271void
2275GMT_cancel (struct MeshTunnel3Queue *q) 2272GMT_cancel (struct MeshTunnel3Queue *q)
2276{ 2273{
2277 if (NULL != q->q) 2274 if (NULL != q->cq)
2278 { 2275 {
2279 GMC_cancel (q->q); 2276 GMC_cancel (q->cq);
2280 /* message_sent() will be called and free q */ 2277 /* message_sent() will be called and free q */
2281 } 2278 }
2282 else if (NULL != q->tq) 2279 else if (NULL != q->tqd)
2283 { 2280 {
2284 unqueue_data (q->tq); 2281 unqueue_data (q->tqd);
2285 } 2282 }
2286 else 2283 else
2287 { 2284 {