aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-12-09 19:58:51 +0000
committerBart Polot <bart@net.in.tum.de>2013-12-09 19:58:51 +0000
commitc712a1f8b2df7406ac6d7a3346e2b066a23b37ef (patch)
treef85e074df00e35282e88f8d528a8887ba6c1aaaa
parent94112b38d0c9fe7b9f653720e7a18972526fb46c (diff)
downloadgnunet-c712a1f8b2df7406ac6d7a3346e2b066a23b37ef.tar.gz
gnunet-c712a1f8b2df7406ac6d7a3346e2b066a23b37ef.zip
- crazyness (see doc)
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c
index f03607409..4658d2943 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.c
+++ b/src/mesh/gnunet-service-mesh_tunnel.c
@@ -656,13 +656,23 @@ send_queued_data (struct MeshTunnel3 *t)
656 LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head); 656 LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head);
657 for (tq = t->tq_head; NULL != tq && room > 0; tq = next) 657 for (tq = t->tq_head; NULL != tq && room > 0; tq = next)
658 { 658 {
659 LOG (GNUNET_ERROR_TYPE_DEBUG, " data on channel %s\n", GMCH_2s (tq->ch)); 659 /* GMCH_send_prebuilt_message will call GMT_cancel on the current
660 * queue handler, therefore free'ing tq before calling GMT_send.
661 * Since the data to send is part of tq, we need to provide a copy,
662 * so the data is not invalidated.
663 */
664 struct GNUNET_MessageHeader *msg = (struct GNUNET_MessageHeader *) &tq[1];
665 size_t m_size = ntohs (msg->size);
666 char cbuf[m_size];
667 struct GNUNET_MessageHeader *copy = (struct GNUNET_MessageHeader *) cbuf;
668
669 LOG (GNUNET_ERROR_TYPE_DEBUG, " msg on channel %s\n", GMCH_2s (tq->ch));
660 next = tq->next; 670 next = tq->next;
661 room--; 671 room--;
662 GMCH_send_prebuilt_message ((struct GNUNET_MessageHeader *) &tq[1], 672 memcpy (copy, msg, m_size);
673 GMCH_send_prebuilt_message (copy,
663 tq->ch, GMCH_is_origin (tq->ch, GNUNET_YES), 674 tq->ch, GMCH_is_origin (tq->ch, GNUNET_YES),
664 NULL); 675 NULL);
665 unqueue_data (tq);
666 } 676 }
667 LOG (GNUNET_ERROR_TYPE_DEBUG, 677 LOG (GNUNET_ERROR_TYPE_DEBUG,
668 "GMT_send_queued_data end\n", 678 "GMT_send_queued_data end\n",