aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-09-04 17:40:26 +0000
committerBart Polot <bart@net.in.tum.de>2012-09-04 17:40:26 +0000
commit60b4d449c930132278323aa3d9ad3ec85f812e0a (patch)
treefd65419570e5254c266aae4cc6d28ebb8e18040f /src/mesh/gnunet-service-mesh.c
parentce8058a2111f0ed3595cc816c7ebfc4222863569 (diff)
downloadgnunet-60b4d449c930132278323aa3d9ad3ec85f812e0a.tar.gz
gnunet-60b4d449c930132278323aa3d9ad3ec85f812e0a.zip
- correct update of tunnel queue for multicast messages
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index a294bbd39..075430a23 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -115,9 +115,12 @@ struct MeshData
115 /** Tunnel it belongs to. */ 115 /** Tunnel it belongs to. */
116 struct MeshTunnel *t; 116 struct MeshTunnel *t;
117 117
118 /** How many remaining neighbors we need to send this to. */ 118 /** How many remaining neighbors still hav't got it. */
119 unsigned int reference_counter; 119 unsigned int reference_counter;
120 120
121 /** How many remaining neighbors we need to send this to. */
122 unsigned int total_out;
123
121 /** Size of the data. */ 124 /** Size of the data. */
122 size_t data_len; 125 size_t data_len;
123 126
@@ -2261,6 +2264,7 @@ send_message (const struct GNUNET_MessageHeader *message,
2261 } 2264 }
2262 info->mesh_data->data_len = size; 2265 info->mesh_data->data_len = size;
2263 info->mesh_data->reference_counter = 1; 2266 info->mesh_data->reference_counter = 1;
2267 info->mesh_data->total_out = 1;
2264 neighbor = peer_info_get (peer); 2268 neighbor = peer_info_get (peer);
2265 for (p = neighbor->path_head; NULL != p; p = p->next) 2269 for (p = neighbor->path_head; NULL != p; p = p->next)
2266 { 2270 {
@@ -3337,6 +3341,10 @@ tunnel_send_multicast (struct MeshTunnel *t,
3337 GNUNET_free (mdata); 3341 GNUNET_free (mdata);
3338 t->fwd_queue_n--; 3342 t->fwd_queue_n--;
3339 } 3343 }
3344 else
3345 {
3346 mdata->total_out = mdata->reference_counter;
3347 }
3340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3348 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3341 " sending a multicast packet done\n"); 3349 " sending a multicast packet done\n");
3342 return; 3350 return;
@@ -4672,9 +4680,17 @@ queue_send (void *cls, size_t size, void *buf)
4672 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* multicast\n"); 4680 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* multicast\n");
4673 { 4681 {
4674 struct MeshTransmissionDescriptor *info = queue->cls; 4682 struct MeshTransmissionDescriptor *info = queue->cls;
4675 if (info->mesh_data->reference_counter == 1) 4683
4684 if ((1 == info->mesh_data->reference_counter
4685 && GNUNET_YES == t->speed_min)
4686 ||
4687 (info->mesh_data->total_out == info->mesh_data->reference_counter
4688 && GNUNET_NO == t->speed_min))
4689 {
4690 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4691 "********* considered sent\n");
4676 t->fwd_queue_n--; 4692 t->fwd_queue_n--;
4677 // FIXME fc (t->fwd_queue_n--) 4693 }
4678 } 4694 }
4679 data_size = send_core_data_multicast(queue->cls, size, buf); 4695 data_size = send_core_data_multicast(queue->cls, size, buf);
4680 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_MULTICAST); 4696 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_MULTICAST);