aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesh/gnunet-service-mesh-new.c79
1 files changed, 29 insertions, 50 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c
index 63a8f25d0..c002910dd 100644
--- a/src/mesh/gnunet-service-mesh-new.c
+++ b/src/mesh/gnunet-service-mesh-new.c
@@ -2643,6 +2643,7 @@ queue_send (void *cls, size_t size, void *buf)
2643 struct GNUNET_PeerIdentity dst_id; 2643 struct GNUNET_PeerIdentity dst_id;
2644 struct MeshFlowControl *fc; 2644 struct MeshFlowControl *fc;
2645 size_t data_size; 2645 size_t data_size;
2646 uint16_t type;
2646 2647
2647 peer->core_transmit = NULL; 2648 peer->core_transmit = NULL;
2648 2649
@@ -2684,6 +2685,7 @@ queue_send (void *cls, size_t size, void *buf)
2684 t = queue->tunnel; 2685 t = queue->tunnel;
2685 GNUNET_assert (0 < t->pending_messages); 2686 GNUNET_assert (0 < t->pending_messages);
2686 t->pending_messages--; 2687 t->pending_messages--;
2688 type = 0;
2687 2689
2688 /* Fill buf */ 2690 /* Fill buf */
2689 switch (queue->type) 2691 switch (queue->type)
@@ -2703,17 +2705,7 @@ queue_send (void *cls, size_t size, void *buf)
2703 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: 2705 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
2704 data_size = send_core_data_raw (queue->cls, size, buf); 2706 data_size = send_core_data_raw (queue->cls, size, buf);
2705 msg = (struct GNUNET_MessageHeader *) buf; 2707 msg = (struct GNUNET_MessageHeader *) buf;
2706 switch (ntohs (msg->type)) // Type of preconstructed message 2708 type = ntohs (msg->type);
2707 {
2708 case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
2709 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST);
2710 break;
2711 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
2712 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
2713 break;
2714 default:
2715 break;
2716 }
2717 break; 2709 break;
2718 case GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE: 2710 case GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE:
2719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* path create\n"); 2711 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* path create\n");
@@ -2730,38 +2722,23 @@ queue_send (void *cls, size_t size, void *buf)
2730 queue->type); 2722 queue->type);
2731 data_size = 0; 2723 data_size = 0;
2732 } 2724 }
2733 switch (queue->type) 2725
2726 /* Free queue, but cls was freed by send_core_* */
2727 queue_destroy (queue, GNUNET_NO);
2728
2729 /* Send ACK if needed, after accounting for sent ID in fc->queue_n */
2730 switch (type)
2734 { 2731 {
2735 case GNUNET_MESSAGE_TYPE_MESH_UNICAST: 2732 case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
2733 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST);
2734 break;
2736 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: 2735 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
2737// if (cinfo->send_buffer[cinfo->send_buffer_start] != queue) 2736 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN);
2738// { FIXME
2739// GNUNET_break (0);
2740// GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2741// "at pos %u (%p) != %p\n",
2742// cinfo->send_buffer_start,
2743// cinfo->send_buffer[cinfo->send_buffer_start],
2744// queue);
2745// }
2746// if (cinfo->send_buffer_n > 0)
2747// {
2748// cinfo->send_buffer[cinfo->send_buffer_start] = NULL;
2749// cinfo->send_buffer_n--;
2750// cinfo->send_buffer_start++;
2751// cinfo->send_buffer_start %= t->fwd_queue_max;
2752// }
2753// else
2754// {
2755// GNUNET_break (0);
2756// }
2757 break; 2737 break;
2758 default: 2738 default:
2759 break; 2739 break;
2760 } 2740 }
2761 2741
2762 /* Free queue, but cls was freed by send_core_* */
2763 queue_destroy (queue, GNUNET_NO);
2764
2765 if (GNUNET_YES == t->destroy && 0 == t->pending_messages) 2742 if (GNUNET_YES == t->destroy && 0 == t->pending_messages)
2766 { 2743 {
2767 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* destroying tunnel!\n"); 2744 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* destroying tunnel!\n");
@@ -2786,23 +2763,25 @@ queue_send (void *cls, size_t size, void *buf)
2786 &queue_send, 2763 &queue_send,
2787 peer); 2764 peer);
2788 } 2765 }
2789 else 2766 else if (NULL != peer->queue_head)
2790 { 2767 {
2791 if (NULL != peer->queue_head) 2768 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
2769 "********* %s stalled\n",
2770 GNUNET_i2s(&my_full_id));
2771 if (peer->id == t->next_hop)
2772 fc = &t->next_fc;
2773 else if (peer->id == t->prev_hop)
2774 fc = &t->prev_fc;
2775 else
2792 { 2776 {
2793 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 2777 GNUNET_break (0);
2794 "********* %s stalled\n", 2778 fc = NULL;
2795 GNUNET_i2s(&my_full_id)); 2779 }
2796 if (peer->id == t->next_hop) 2780 if (NULL != fc && GNUNET_SCHEDULER_NO_TASK == fc->poll_task)
2797 fc = &t->next_fc; 2781 {
2798 else 2782 fc->t = t;
2799 fc = &t->prev_fc; 2783 fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time,
2800 if (GNUNET_SCHEDULER_NO_TASK == fc->poll_task) 2784 &tunnel_poll, fc);
2801 {
2802 fc->t = t;
2803 fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time,
2804 &tunnel_poll, fc);
2805 }
2806 } 2785 }
2807 } 2786 }
2808 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* return %d\n", data_size); 2787 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* return %d\n", data_size);